Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JNI] Expose java API for cudf::io::config_host_memory_resource #15745

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions java/src/main/java/ai/rapids/cudf/PinnedMemoryPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,15 @@ private synchronized HostMemoryBuffer tryAllocateInternal(long bytes) {
private synchronized void free(long address, long size) {
Rmm.freeFromPinnedPool(this.poolHandle, address, size);
}

/**
* Sets the size of the cuDF default pinned pool.
*
* @note This has to be called before cuDF functions are executed.
* @param size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param size
* @param size ???

*/
public static synchronized void configureDefaultCudfPinnedPoolSize(long size) {
Rmm.configureDefaultCudfPinnedPoolSize(size);
}

}
8 changes: 8 additions & 0 deletions java/src/main/java/ai/rapids/cudf/Rmm.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ public static synchronized void initialize(int allocationMode, LogConf logConf,
}
}

/**
* Sets the size of the cuDF default pinned pool.
*
* @note This has to be called before cuDF functions are executed.
* @param size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param size
* @param size ???

*/
public static synchronized native void configureDefaultCudfPinnedPoolSize(long size);

/**
* Get the most recently set pool size or -1 if RMM has not been initialized or pooling is
* not enabled.
Expand Down
12 changes: 12 additions & 0 deletions java/src/main/native/src/RmmJni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,4 +1106,16 @@ JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_freeFromFallbackPinnedPool(JNIEnv
}
CATCH_STD(env, )
}

JNIEXPORT void JNICALL Java_ai_rapids_cudf_Rmm_configureDefaultCudfPinnedPoolSize(JNIEnv* env,
jclass clazz,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove name of the unused var to avoid compile warning.

Suggested change
jclass clazz,
jclass,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this in every single API in this file and probably other, but I am not seeing warnings on it. I'd rather keep it as is at this stage.

jlong size)
{
cudf::io::config_host_memory_resource(size);
try {
cudf::jni::auto_set_device(env);
cudf::io::config_host_memory_resource(size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch, this was a copy and paste error

}
CATCH_STD(env, )
}
}
Loading