#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
use clap::Parser;
use server::Server;
use sp1_gpu_cudart::run_in_place;
mod server;
#[derive(Debug, Parser)]
struct Args {
#[clap(long)]
version: bool,
}
#[tokio::main]
#[allow(clippy::print_stdout)]
async fn main() {
tracing_subscriber::fmt::init();
let args = Args::parse();
if args.version {
println!("{}", sp1_primitives::SP1_VERSION);
return;
}
let cuda_device_id = std::env::var("CUDA_VISIBLE_DEVICES")
.expect("CUDA_VISIBLE_DEVICES must be set")
.parse()
.expect("Expected only one CUDA device as a u32");
let server = Server { cuda_device_id };
if let Err(e) = run_in_place(|scope| server.run(scope)).await.await {
eprintln!("Error running server: {e}");
}
}