Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Bellina <[email protected]>
  • Loading branch information
abellina committed Dec 8, 2024
1 parent 960b3c5 commit 3f7e1bd
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,27 +772,21 @@ JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_releaseArenaMemoryResource(JNIEnv
CATCH_STD(env, )
}

JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Rmm_newCudaAsyncMemoryResource(JNIEnv* env,
jclass clazz,
jlong init,
jlong release,
jboolean fabric)
JNIEXPORT jlong JNICALL Java_ai_rapids_cudf_Rmm_newCudaAsyncMemoryResource(
JNIEnv* env, jclass clazz, jlong init, jlong release, jboolean fabric)
{
try {
cudf::jni::auto_set_device(env);
// when we are using fabric, we need to set the memory access to be

// when we are using fabric, we need to set the memory access to be
// read_write, in order for peer GPUs to have access to this memory.
auto [handle_type, prot_flag] = fabric ?
std::pair{
rmm::mr::cuda_async_memory_resource::allocation_handle_type::fabric,
rmm::mr::cuda_async_memory_resource::access_flags::read_write} :
std::pair{
rmm::mr::cuda_async_memory_resource::allocation_handle_type::none,
rmm::mr::cuda_async_memory_resource::access_flags::none};

auto ret = new rmm::mr::cuda_async_memory_resource(
init, release, handle_type, prot_flag);
auto [handle_type, prot_flag] =
fabric ? std::pair{rmm::mr::cuda_async_memory_resource::allocation_handle_type::fabric,
rmm::mr::cuda_async_memory_resource::access_flags::read_write}
: std::pair{rmm::mr::cuda_async_memory_resource::allocation_handle_type::none,
rmm::mr::cuda_async_memory_resource::access_flags::none};

auto ret = new rmm::mr::cuda_async_memory_resource(init, release, handle_type, prot_flag);

return reinterpret_cast<jlong>(ret);
}
Expand Down

0 comments on commit 3f7e1bd

Please sign in to comment.