Skip to content

Commit

Permalink
Update CMakelists for new RMM version
Browse files Browse the repository at this point in the history
  • Loading branch information
gartavanis committed Jun 13, 2024
1 parent 6b08087 commit 4207f8e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions pfsimulator/parflow_exe/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,20 @@ int main(int argc, char *argv [])
* Initialize RMM pool allocator
*-----------------------------------------------------------------------*/
#ifdef PARFLOW_HAVE_RMM
// RMM
rmmOptions_t rmmOptions;
rmmOptions.allocation_mode = (rmmAllocationMode_t) (PoolAllocation | CudaManagedMemory);
rmmOptions.initial_pool_size = 1; // size = 0 initializes half the device memory
rmmOptions.enable_logging = false;
RMM_ERR(rmmInitialize(&rmmOptions));
#include <pool_memory_resource.hpp>
rmm::mr::cuda_memory_resource cuda_mr;
// Construct a resource that uses a coalescing best-fit pool allocator
// With the pool initially half of available device memory
auto initial_size = rmm::percent_of_free_device_memory(100);
rmm::mr::pool_memory_resource<rmm::mr::cuda_memory_resource> pool_mr{&cuda_mr, initial_size};
rmm::mr::set_current_device_resource(&pool_mr); // Updates the current device resource pointer to `pool_mr`
// rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource(); // Points to `pool_mr`

// rmmOptions_t rmmOptions;
// rmmOptions.allocation_mode = (rmmAllocationMode_t) (PoolAllocation | CudaManagedMemory);
// rmmOptions.initial_pool_size = 1; // size = 0 initializes half the device memory
// rmmOptions.enable_logging = false;
// RMM_ERR(rmmInitialize(&rmmOptions));
#endif // PARFLOW_HAVE_RMM

wall_clock_time = amps_Clock();
Expand Down
2 changes: 1 addition & 1 deletion pfsimulator/parflow_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ endif(${PARFLOW_HAVE_KOKKOS})
endif( ${PARFLOW_HAVE_KOKKOS} )

if( ${PARFLOW_HAVE_RMM} )
target_link_libraries(pfsimulator rmm)
target_link_libraries(pfsimulator rmm:rmm)
target_include_directories(pfsimulator PRIVATE ${RMM_INCLUDE})
target_compile_definitions(pfsimulator PRIVATE PARFLOW_HAVE_RMM)
endif( ${PARFLOW_HAVE_RMM} )
Expand Down

0 comments on commit 4207f8e

Please sign in to comment.