@@ -39,7 +39,6 @@ macro_rules! with_cuda {
3939 $inner
4040
4141 if let Err ( ( _err, val) ) = <$r#type >:: drop( $var) {
42- //eprintln!("{:?}", err);
4342 std:: mem:: forget( val) ;
4443 }
4544 } ;
@@ -49,7 +48,6 @@ macro_rules! with_cuda {
4948 $inner
5049
5150 if let Err ( ( _err, val) ) = <$r#type >:: drop( $var) {
52- //eprintln!("{:?}", err);
5351 std:: mem:: forget( val) ;
5452 }
5553 } ;
@@ -158,7 +156,7 @@ impl CudaSimulation {
158156 rng : G ,
159157 reporter : & mut impl Reporter < InMemoryHabitat , InMemoryLineageReference > ,
160158 ) -> Result < ( f64 , usize ) > {
161- const SIMULATION_STEP_SLICE : usize = 1_000_usize ;
159+ const SIMULATION_STEP_SLICE : usize = 100_usize ;
162160
163161 let habitat = InMemoryHabitat :: new ( habitat. clone ( ) ) ;
164162 let dispersal_sampler = InMemoryPackedAliasDispersalSampler :: new ( dispersal, & habitat) ?;
@@ -167,7 +165,6 @@ impl CudaSimulation {
167165 let event_sampler = IndependentEventSampler :: default ( ) ;
168166 let active_lineage_sampler = IndependentActiveLineageSampler :: default ( ) ;
169167
170- // TODO: Should we copy the heap contents back over?
171168 let mut simulation = Simulation :: builder ( )
172169 . speciation_probability_per_generation ( speciation_probability_per_generation)
173170 . habitat ( habitat)
@@ -190,15 +187,8 @@ impl CudaSimulation {
190187 + ( total_individuals % cuda_block_length > 0 ) as u32
191188 } ) ;
192189
193- let mut event_buffer: EventBufferHost < InMemoryHabitat , InMemoryLineageReference > =
194- EventBufferHost :: new ( & cuda_block_size, & cuda_grid_size, SIMULATION_STEP_SLICE ) ?;
195-
196- //let (time, steps) = simulation.simulate(rng, reporter);
197-
198190 let module_data = CString :: new ( include_str ! ( env!( "KERNEL_PTX_PATH" ) ) ) . unwrap ( ) ;
199191
200- //println!("{}", module_data.to_str().unwrap());
201-
202192 // Initialize the CUDA API
203193 rustacuda:: init ( CudaFlags :: empty ( ) ) ?;
204194
@@ -221,6 +211,9 @@ impl CudaSimulation {
221211 print_context_resource_limits( ) ;
222212 print_kernel_function_attributes( & simulate_kernel) ;
223213
214+ let mut event_buffer: EventBufferHost <InMemoryHabitat , InMemoryLineageReference > =
215+ EventBufferHost :: new( & cuda_block_size, & cuda_grid_size, SIMULATION_STEP_SLICE ) ?;
216+
224217 if let Err ( err) = simulation. lend_to_cuda_mut( |simulation_mut_ptr| {
225218 let block_index_range = 0 ..( cuda_grid_size. x * cuda_grid_size. y * cuda_grid_size. z) ;
226219
0 commit comments