Skip to content

Commit

Permalink
Merge pull request openucx#6020 from petro-rudenko/jucx/memtype-const…
Browse files Browse the repository at this point in the history
…ants

JUCX: UCS Memory type constants.
  • Loading branch information
yosefe authored Dec 14, 2020
2 parents 0580ef0 + 2779ba6 commit 475ab4e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bindings/java/src/main/java/org/openucx/jucx/ucs/UcsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ public static class STATUS {
public static int UCS_ERR_LAST;
}

public static class MEMORY_TYPE {
static {
load();
}

public static int UCS_MEMORY_TYPE_HOST; // Default system memory
public static int UCS_MEMORY_TYPE_CUDA; // NVIDIA CUDA memory
public static int UCS_MEMORY_TYPE_CUDA_MANAGED; // NVIDIA CUDA managed (or unified) memory
public static int UCS_MEMORY_TYPE_ROCM; // AMD ROCM memory
public static int UCS_MEMORY_TYPE_ROCM_MANAGED; // AMD ROCM managed system memory
public static int UCS_MEMORY_TYPE_LAST;
public static int UCS_MEMORY_TYPE_UNKNOWN;
}

private static void load() {
NativeLibs.load();
loadConstants();
Expand Down
10 changes: 10 additions & 0 deletions bindings/java/src/main/native/ucs_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ Java_org_openucx_jucx_ucs_UcsConstants_loadConstants(JNIEnv *env, jclass ucs_cla
JUCX_DEFINE_INT_CONSTANT(UCS_ERR_ENDPOINT_TIMEOUT);
JUCX_DEFINE_INT_CONSTANT(UCS_ERR_LAST_ENDPOINT_FAILURE);
JUCX_DEFINE_INT_CONSTANT(UCS_ERR_LAST);

// Memory type
cls = env->FindClass("org/openucx/jucx/ucs/UcsConstants$MEMORY_TYPE");
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_HOST);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_CUDA);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_CUDA_MANAGED);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_ROCM);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_ROCM_MANAGED);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_LAST);
JUCX_DEFINE_INT_CONSTANT(UCS_MEMORY_TYPE_UNKNOWN);
}

0 comments on commit 475ab4e

Please sign in to comment.