From 941f74bcd5c61c0fec64900de0e015a8bc82f371 Mon Sep 17 00:00:00 2001 From: Michael Palumbo Date: Mon, 15 Apr 2024 16:55:50 -0400 Subject: [PATCH] contiguous only keyword for sim --- src/convenience.jl | 16 +++++++++------- src/gpu/gpu_sim.jl | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/convenience.jl b/src/convenience.jl index 558398d8..ac9c5f93 100644 --- a/src/convenience.jl +++ b/src/convenience.jl @@ -10,17 +10,18 @@ Synthesize spectra given parameters in `spec` and `disk` instances. function synthesize_spectra(spec::SpecParams{T}, disk::DiskParams{T}; seed_rng::Bool=false, verbose::Bool=true, use_gpu::Bool=false, precision::DataType=Float64, - skip_times::BitVector=falses(disk.Nt)) where T<:AF + skip_times::BitVector=falses(disk.Nt), + contiguous_only::Bool=false) where T<:AF # call appropriate simulation function on cpu or gpu if use_gpu - return synth_gpu(spec, disk, seed_rng, verbose, precision, skip_times) + return synth_gpu(spec, disk, seed_rng, verbose, precision, skip_times, contiguous_only) else - return synth_cpu(spec, disk, seed_rng, verbose, skip_times) + return synth_cpu(spec, disk, seed_rng, verbose, skip_times, contiguous_only) end end function synth_cpu(spec::SpecParams{T}, disk::DiskParams{T}, seed_rng::Bool, - verbose::Bool, skip_times::BitVector) where T<:AF + verbose::Bool, skip_times::BitVector, contiguous_only::Bool) where T<:AF # parse out dimensions for memory allocation N = disk.N Nt = disk.Nt @@ -49,7 +50,7 @@ function synth_cpu(spec::SpecParams{T}, disk::DiskParams{T}, seed_rng::Bool, if verbose println("\t>>> Template: " * splitdir(file)[end]) end - soldata = SolarData(fname=file) + soldata = SolarData(fname=file, contiguous_only=contiguous_only) # get conv. blueshift and keys from input data get_keys_and_cbs!(wsp, soldata) @@ -75,7 +76,8 @@ function synth_cpu(spec::SpecParams{T}, disk::DiskParams{T}, seed_rng::Bool, end function synth_gpu(spec::SpecParams{T}, disk::DiskParams{T}, seed_rng::Bool, - verbose::Bool, precision::DataType, skip_times::BitVector) where T<:AF + verbose::Bool, precision::DataType, skip_times::BitVector, + contiguous_only::Bool) where T<:AF # make sure there is actually a GPU to use @assert CUDA.functional() @@ -122,7 +124,7 @@ function synth_gpu(spec::SpecParams{T}, disk::DiskParams{T}, seed_rng::Bool, if verbose println("\t>>> Template: " * splitdir(file)[end]) end - soldata_cpu = SolarData(fname=file) + soldata_cpu = SolarData(fname=file, contiguous_only=contiguous_only) soldata = GPUSolarData(soldata_cpu, precision=precision) # get conv. blueshift and keys from input data diff --git a/src/gpu/gpu_sim.jl b/src/gpu/gpu_sim.jl index 12335218..49e1a6db 100644 --- a/src/gpu/gpu_sim.jl +++ b/src/gpu/gpu_sim.jl @@ -111,6 +111,6 @@ function disk_sim_gpu(spec::SpecParams{T1}, disk::DiskParams{T1}, soldata::GPUSo @cusync flux_cpu .= Array(flux) # make sure nothing is still running on GPU - CUDA.synchronize() + # CUDA.synchronize() return nothing end