Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr committed Jan 10, 2024
1 parent 5cd2354 commit 65ed1c8
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 180 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions rustcoalescence/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ necsim-partitioning-mpi = ["dep:necsim-partitioning-mpi"]

rustcoalescence-algorithms-gillespie = ["dep:rustcoalescence-algorithms-gillespie"]
rustcoalescence-algorithms-independent = ["dep:rustcoalescence-algorithms-independent"]
rustcoalescence-algorithms-cuda = ["dep:rustcoalescence-algorithms-cuda", "dep:necsim-impls-cuda", "dep:rust-cuda"]
rustcoalescence-algorithms-cuda = ["dep:rustcoalescence-algorithms-cuda", "dep:rust-cuda"]

[dependencies]
necsim-core = { path = "../necsim/core" }
necsim-core-bond = { path = "../necsim/core/bond" }
necsim-impls-no-std = { path = "../necsim/impls/no-std" }
necsim-impls-cuda = { path = "../necsim/impls/cuda", optional = true }
necsim-impls-std = { path = "../necsim/impls/std" }
necsim-plugins-core = { path = "../necsim/plugins/core", features = ["import"] }
necsim-partitioning-core = { path = "../necsim/partitioning/core" }
Expand Down
23 changes: 12 additions & 11 deletions rustcoalescence/algorithms/cuda/cpu-kernel/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use necsim_core::{
CoalescenceSampler, DispersalSampler, EmigrationExit, Habitat, ImmigrationEntry,
LineageStore, MathsCore, PrimeableRng, SpeciationProbability, TurnoverRate,
},
reporter::boolean::{Boolean, False, True},
reporter::boolean::Boolean, // reporter::boolean::{Boolean, False, True},
};
use necsim_impls_no_std::cogs::{
active_lineage_sampler::singular::SingularActiveLineageSampler,
Expand Down Expand Up @@ -46,16 +46,17 @@ unsafe impl<
>
CompiledKernelPtx<
simulate<M, H, G, S, X, D, C, T, N, E, I, A, ReportSpeciation, ReportDispersal>,
> for SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, ReportSpeciation, ReportDispersal>
where
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, False, False>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, False, False>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, False, True>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, False, True>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, True, False>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, True, False>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, True, True>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, True, True>>,
>
for SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, ReportSpeciation, ReportDispersal>
//where
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, False, False>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, False, False>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, False, True>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, False, True>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, True, False>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, True, False>>,
// SimulationKernelPtx<M, H, G, S, X, D, C, T, N, E, I, A, True, True>:
// CompiledKernelPtx<simulate<M, H, G, S, X, D, C, T, N, E, I, A, True, True>>,
{
default fn get_ptx() -> &'static CStr {
unsafe { unreachable_cuda_simulation_linking_reporter() }
Expand Down
23 changes: 10 additions & 13 deletions rustcoalescence/algorithms/cuda/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::marker::PhantomData;
use necsim_core::{cogs::MathsCore, reporter::Reporter, simulation::SimulationBuilder};
use necsim_core_bond::NonNegativeF64;

use necsim_impls_cuda::cogs::rng::CudaRng;
use necsim_impls_no_std::{
cogs::{
active_lineage_sampler::independent::event_time_sampler::exp::ExpEventTimeSampler,
Expand All @@ -16,7 +15,6 @@ use necsim_impls_no_std::{
origin_sampler::{
decomposition::DecompositionOriginSampler, pre_sampler::OriginPreSampler,
},
rng::wyhash::WyHash,
},
parallelisation::Status,
};
Expand All @@ -25,7 +23,7 @@ use necsim_partitioning_core::LocalPartition;
use rustcoalescence_algorithms::result::SimulationOutcome;
use rustcoalescence_scenarios::Scenario;

use rustcoalescence_algorithms_cuda_gpu_kernel::simulate;
use rustcoalescence_algorithms_cuda_gpu_kernel::{simulate, PrimeableRng};

use rust_cuda::{
deps::rustacuda::{
Expand All @@ -51,17 +49,18 @@ use crate::{
pub fn initialise_and_simulate<
'p,
M: MathsCore + Sync,
O: Scenario<M, CudaRng<M, WyHash<M>>>,
G: PrimeableRng<M> + RustToCuda + Sync,
O: Scenario<M, G>,
R: Reporter,
P: LocalPartition<'p, R>,
I: Iterator<Item = u64>,
L: CudaLineageStoreSampleInitialiser<M, CudaRng<M, WyHash<M>>, O, Error>,
L: CudaLineageStoreSampleInitialiser<M, G, O, Error>,
Error: From<CudaError>,
Ptx: CompiledKernelPtx<
simulate<
M,
O::Habitat,
CudaRng<M, WyHash<M>>,
G,
IndependentLineageStore<M, O::Habitat>,
NeverEmigrationExit,
L::DispersalSampler,
Expand All @@ -71,7 +70,7 @@ pub fn initialise_and_simulate<
IndependentEventSampler<
M,
O::Habitat,
CudaRng<M, WyHash<M>>,
G,
NeverEmigrationExit,
L::DispersalSampler,
O::TurnoverRate,
Expand All @@ -85,17 +84,16 @@ pub fn initialise_and_simulate<
>,
>(
args: &CudaArguments,
rng: CudaRng<M, WyHash<M>>,
rng: G,
scenario: O,
pre_sampler: OriginPreSampler<M, I>,
pause_before: Option<NonNegativeF64>,
local_partition: &mut P,
lineage_store_sampler_initialiser: L,
) -> Result<SimulationOutcome<M, CudaRng<M, WyHash<M>>>, Error>
) -> Result<SimulationOutcome<M, G>, Error>
where
O::Habitat: RustToCuda + Sync,
O::DispersalSampler<InMemoryPackedAliasDispersalSampler<M, O::Habitat, CudaRng<M, WyHash<M>>>>:
RustToCuda + Sync,
O::DispersalSampler<InMemoryPackedAliasDispersalSampler<M, O::Habitat, G>>: RustToCuda + Sync,
O::TurnoverRate: RustToCuda + Sync,
O::SpeciationProbability: RustToCuda + Sync,
{
Expand All @@ -106,8 +104,7 @@ where
speciation_probability,
origin_sampler_auxiliary,
decomposition_auxiliary,
) = scenario
.build::<InMemoryPackedAliasDispersalSampler<M, O::Habitat, CudaRng<M, WyHash<M>>>>();
) = scenario.build::<InMemoryPackedAliasDispersalSampler<M, O::Habitat, G>>();
let coalescence_sampler = IndependentCoalescenceSampler::default();
let event_sampler = IndependentEventSampler::default();

Expand Down
Loading

0 comments on commit 65ed1c8

Please sign in to comment.