Skip to content

Commit 933569a

Browse files
Implement comprehensive token-free result sharing
- Add 4 token-free sharing methods for benchmark results - Anonymous GitHub gists (no auth required) - Email templates for manual submission to maintainers - Discord/Slack formatted posts for community channels - HTTP POST scripts for future API endpoints - Add HTTP and JSON dependencies for gist creation - Fallback gracefully from PR → Issue → Token-free → Local - Ensures benchmark data can always be shared with community - Removes GitHub token barriers for result sharing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 44492a5 commit 933569a

File tree

3 files changed

+252
-2
lines changed

3 files changed

+252
-2
lines changed

lib/LinearSolveAutotune/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
1010
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
1111
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
1212
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
13+
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
14+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1315
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1416
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
1517
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
@@ -36,6 +38,8 @@ Base64 = "1"
3638
CSV = "0.10"
3739
DataFrames = "1"
3840
GitHub = "5"
41+
HTTP = "1"
42+
JSON = "0.21"
3943
Plots = "1"
4044
PrettyTables = "2"
4145
Preferences = "1"

lib/LinearSolveAutotune/src/LinearSolveAutotune.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ using RecursiveFactorization # Hard dependency to ensure RFLUFactorization is a
1616

1717
# Optional dependencies for telemetry and plotting
1818
using GitHub
19+
using HTTP
20+
using JSON
1921
using Plots
2022

2123
# Load JLL packages when available for better library access

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 246 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,18 @@ function upload_to_github(content::String, plot_files::Union{Nothing, Tuple, Dic
336336
results_df::DataFrame, system_info::Dict, categories::Dict)
337337

338338
if auth === nothing
339-
@info "⚠️ No GitHub authentication available. Saving results locally instead of uploading."
340-
# Save locally as fallback
339+
@info "⚠️ No GitHub authentication available. Using token-free sharing methods..."
340+
341+
# Try token-free sharing methods
342+
try
343+
share_results_token_free(content, plot_files, results_df, system_info, categories)
344+
return
345+
catch e
346+
@warn "Token-free sharing failed: $e"
347+
@info "📁 Falling back to local save..."
348+
end
349+
350+
# Save locally as final fallback
341351
fallback_file = "autotune_results_$(replace(string(Dates.now()), ":" => "-")).md"
342352
open(fallback_file, "w") do f
343353
write(f, content)
@@ -428,6 +438,240 @@ function upload_to_github(content::String, plot_files::Union{Nothing, Tuple, Dic
428438
end
429439
end
430440

441+
"""
442+
share_results_token_free(content, plot_files, results_df, system_info, categories)
443+
444+
Share benchmark results without requiring GitHub authentication using various methods.
445+
"""
446+
function share_results_token_free(content, plot_files, results_df, system_info, categories)
447+
@info "🌐 Attempting token-free result sharing methods..."
448+
449+
success_methods = String[]
450+
451+
# Method 1: Create a shareable gist URL (read-only)
452+
try
453+
gist_url = create_anonymous_gist(content, system_info)
454+
if gist_url !== nothing
455+
@info "✅ Anonymous gist created: $gist_url"
456+
@info "📋 Share this URL with the LinearSolve.jl community!"
457+
push!(success_methods, "Anonymous Gist")
458+
end
459+
catch e
460+
@debug "Anonymous gist creation failed: $e"
461+
end
462+
463+
# Method 2: Generate a formatted email template
464+
try
465+
email_content = create_email_template(content, system_info, categories)
466+
email_file = "benchmark_email_$(replace(string(Dates.now()), ":" => "-")).txt"
467+
open(email_file, "w") do f
468+
write(f, email_content)
469+
end
470+
@info "✅ Email template created: $email_file"
471+
@info "📧 Send this file content to the LinearSolve.jl maintainers!"
472+
push!(success_methods, "Email Template")
473+
catch e
474+
@debug "Email template creation failed: $e"
475+
end
476+
477+
# Method 3: Generate Discord/Slack sharing format
478+
try
479+
discord_content = create_discord_format(content, system_info)
480+
discord_file = "benchmark_discord_$(replace(string(Dates.now()), ":" => "-")).txt"
481+
open(discord_file, "w") do f
482+
write(f, discord_content)
483+
end
484+
@info "✅ Discord/Slack format created: $discord_file"
485+
@info "💬 Share this in the Julia/LinearSolve community channels!"
486+
push!(success_methods, "Discord Format")
487+
catch e
488+
@debug "Discord format creation failed: $e"
489+
end
490+
491+
# Method 4: Generate a simple HTTP POST command
492+
try
493+
http_command = create_http_post_command(content, system_info)
494+
http_file = "benchmark_http_$(replace(string(Dates.now()), ":" => "-")).sh"
495+
open(http_file, "w") do f
496+
write(f, http_command)
497+
end
498+
@info "✅ HTTP POST command created: $http_file"
499+
@info "🌐 Run this script to submit via HTTP (when endpoint available)"
500+
push!(success_methods, "HTTP POST")
501+
catch e
502+
@debug "HTTP POST command creation failed: $e"
503+
end
504+
505+
if !isempty(success_methods)
506+
@info "🎉 Successfully created $(length(success_methods)) sharing methods: $(join(success_methods, ", "))"
507+
@info "🤝 Your benchmark data helps improve LinearSolve.jl for everyone!"
508+
return true
509+
else
510+
return false
511+
end
512+
end
513+
514+
"""
515+
create_anonymous_gist(content, system_info)
516+
517+
Create an anonymous GitHub gist with benchmark results (no auth required).
518+
"""
519+
function create_anonymous_gist(content, system_info)
520+
try
521+
# Create gist payload
522+
cpu_name = get(system_info, "cpu_name", "Unknown CPU")
523+
os_name = get(system_info, "os", "Unknown OS")
524+
timestamp = Dates.format(Dates.now(), "yyyy-mm-dd")
525+
526+
filename = "linearsolve_benchmark_$(cpu_name)_$(os_name)_$(timestamp).md"
527+
# Sanitize filename
528+
filename = replace(filename, r"[^a-zA-Z0-9._-]" => "_")
529+
530+
gist_data = Dict(
531+
"description" => "LinearSolve.jl Autotune Benchmark Results - $cpu_name on $os_name",
532+
"public" => true,
533+
"files" => Dict(
534+
filename => Dict(
535+
"content" => content
536+
)
537+
)
538+
)
539+
540+
# Post to GitHub gist API (no auth required for anonymous gists)
541+
response = HTTP.post(
542+
"https://api.github.com/gists",
543+
["Content-Type" => "application/json"],
544+
JSON.json(gist_data)
545+
)
546+
547+
if response.status == 201
548+
result = JSON.parse(String(response.body))
549+
return result["html_url"]
550+
else
551+
return nothing
552+
end
553+
catch e
554+
@debug "Anonymous gist creation failed: $e"
555+
return nothing
556+
end
557+
end
558+
559+
"""
560+
create_email_template(content, system_info, categories)
561+
562+
Create an email template for manual submission to maintainers.
563+
"""
564+
function create_email_template(content, system_info, categories)
565+
cpu_name = get(system_info, "cpu_name", "Unknown CPU")
566+
os_name = get(system_info, "os", "Unknown OS")
567+
568+
template = """
569+
Subject: LinearSolve.jl Benchmark Results - $cpu_name on $os_name
570+
571+
Dear LinearSolve.jl Maintainers,
572+
573+
I've run the autotune benchmarks and would like to share the results with the community.
574+
575+
$content
576+
577+
---
578+
579+
Technical Details:
580+
- Submitted via: LinearSolveAutotune.jl token-free sharing
581+
- Timestamp: $(Dates.now())
582+
- System: $cpu_name on $os_name
583+
584+
Please feel free to include this data in the community benchmark database.
585+
586+
Best regards,
587+
A LinearSolve.jl User
588+
589+
---
590+
Generated automatically by LinearSolve.jl autotune system
591+
"""
592+
return template
593+
end
594+
595+
"""
596+
create_discord_format(content, system_info)
597+
598+
Create a Discord/Slack-friendly format for community sharing.
599+
"""
600+
function create_discord_format(content, system_info)
601+
cpu_name = get(system_info, "cpu_name", "Unknown CPU")
602+
603+
# Extract key performance numbers from content
604+
lines = split(content, "\n")
605+
summary_lines = String[]
606+
607+
for line in lines
608+
if contains(line, "GFLOPs") || contains(line, "Best algorithm") || contains(line, "CPU:") || contains(line, "OS:")
609+
push!(summary_lines, line)
610+
end
611+
end
612+
613+
discord_content = """
614+
🚀 **LinearSolve.jl Benchmark Results** 🚀
615+
616+
**System**: $cpu_name
617+
**Timestamp**: $(Dates.format(Dates.now(), "yyyy-mm-dd HH:MM"))
618+
619+
**Key Results**:
620+
$(join(summary_lines, "\n"))
621+
622+
```
623+
$content
624+
```
625+
626+
*Generated by LinearSolveAutotune.jl - helping optimize LinearSolve for everyone! 🤖*
627+
628+
#LinearSolve #Julia #Benchmarks
629+
"""
630+
return discord_content
631+
end
632+
633+
"""
634+
create_http_post_command(content, system_info)
635+
636+
Create an HTTP POST command for future submission endpoints.
637+
"""
638+
function create_http_post_command(content, system_info)
639+
# Create a simple curl command for future HTTP submission endpoint
640+
timestamp = replace(string(Dates.now()), ":" => "-")
641+
642+
command = """#!/bin/bash
643+
# LinearSolve.jl Benchmark Submission Script
644+
# Generated on $(Dates.now())
645+
646+
echo "Submitting LinearSolve.jl benchmark results..."
647+
648+
# Note: Update the endpoint URL when available
649+
ENDPOINT="https://api.sciml.ai/linearsolve/benchmarks" # Placeholder endpoint
650+
651+
# Create temporary JSON file
652+
cat > benchmark_data.json << 'EOF'
653+
{
654+
"timestamp": "$(Dates.now())",
655+
"system_info": $(JSON.json(system_info)),
656+
"benchmark_results": $(JSON.json(content))
657+
}
658+
EOF
659+
660+
# Submit via HTTP POST (uncomment when endpoint is ready)
661+
# curl -X POST "\$ENDPOINT" \\
662+
# -H "Content-Type: application/json" \\
663+
# -d @benchmark_data.json
664+
665+
echo "✅ Benchmark data prepared for submission"
666+
echo "📁 Data saved to benchmark_data.json"
667+
echo "🌐 Submit when HTTP endpoint becomes available"
668+
669+
# Clean up
670+
# rm benchmark_data.json
671+
"""
672+
return command
673+
end
674+
431675
"""
432676
create_benchmark_issue(target_repo, fallback_repo, content, auth, system_info)
433677

0 commit comments

Comments
 (0)