enable ROCm for jvm and R
This commit is contained in:
parent
32ae49ab92
commit
40dc263602
@ -32,7 +32,7 @@ namespace common {
|
||||
bool CheckNAN(double v) {
|
||||
return ISNAN(v);
|
||||
}
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
|
||||
double LogGamma(double v) {
|
||||
return lgammafn(v);
|
||||
}
|
||||
|
||||
@ -9,6 +9,11 @@ if(USE_CUDA)
|
||||
${PROJECT_SOURCE_DIR}/jvm-packages/xgboost4j-gpu/src/native/xgboost4j-gpu.cu)
|
||||
endif()
|
||||
|
||||
if(USE_HIP)
|
||||
list(APPEND JVM_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/jvm-packages/xgboost4j-gpu/src/native/xgboost4j-gpu.hip)
|
||||
endif()
|
||||
|
||||
add_library(xgboost4j SHARED ${JVM_SOURCES} ${XGBOOST_OBJ_SOURCES})
|
||||
|
||||
if(ENABLE_ALL_WARNINGS)
|
||||
|
||||
@ -22,6 +22,8 @@ CONFIG = {
|
||||
|
||||
"USE_CUDA": "OFF",
|
||||
"USE_NCCL": "OFF",
|
||||
"USE_HIP": "OFF",
|
||||
"USE_RCCL": "OFF",
|
||||
"JVM_BINDINGS": "ON",
|
||||
"LOG_CAPI_INVOCATION": "OFF"
|
||||
}
|
||||
@ -74,6 +76,7 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--log-capi-invocation', type=str, choices=['ON', 'OFF'], default='OFF')
|
||||
parser.add_argument('--use-cuda', type=str, choices=['ON', 'OFF'], default='OFF')
|
||||
parser.add_argument('--use-hip', type=str, choices=['ON', 'OFF'], default='OFF')
|
||||
cli_args = parser.parse_args()
|
||||
|
||||
if sys.platform == "darwin":
|
||||
@ -84,7 +87,7 @@ if __name__ == "__main__":
|
||||
|
||||
print("building Java wrapper")
|
||||
with cd(".."):
|
||||
build_dir = 'build-gpu' if cli_args.use_cuda == 'ON' else 'build'
|
||||
build_dir = 'build-gpu' if cli_args.use_cuda == 'ON' or cli_args.use_hip == 'ON' else 'build'
|
||||
maybe_makedirs(build_dir)
|
||||
with cd(build_dir):
|
||||
if sys.platform == "win32":
|
||||
@ -103,6 +106,9 @@ if __name__ == "__main__":
|
||||
if cli_args.use_cuda == 'ON':
|
||||
CONFIG['USE_CUDA'] = 'ON'
|
||||
CONFIG['USE_NCCL'] = 'ON'
|
||||
elif cli_args.use_hip== 'ON':
|
||||
CONFIG['USE_HIP'] = 'ON'
|
||||
CONFIG['USE_RCCL'] = 'ON'
|
||||
|
||||
args = ["-D{0}:BOOL={1}".format(k, v) for k, v in CONFIG.items()]
|
||||
|
||||
@ -125,8 +131,8 @@ if __name__ == "__main__":
|
||||
run(f'"{sys.executable}" mapfeat.py')
|
||||
run(f'"{sys.executable}" mknfold.py machine.txt 1')
|
||||
|
||||
xgboost4j = 'xgboost4j-gpu' if cli_args.use_cuda == 'ON' else 'xgboost4j'
|
||||
xgboost4j_spark = 'xgboost4j-spark-gpu' if cli_args.use_cuda == 'ON' else 'xgboost4j-spark'
|
||||
xgboost4j = 'xgboost4j-gpu' if cli_args.use_cuda == 'ON' or cli_args.use_hip== 'ON' else 'xgboost4j'
|
||||
xgboost4j_spark = 'xgboost4j-spark-gpu' if cli_args.use_cuda == 'ON' or cli_args.use_hip == 'ON' else 'xgboost4j-spark'
|
||||
|
||||
print("copying native library")
|
||||
library_name, os_folder = {
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
<maven.wagon.http.retryHandler.count>5</maven.wagon.http.retryHandler.count>
|
||||
<log.capi.invocation>OFF</log.capi.invocation>
|
||||
<use.cuda>OFF</use.cuda>
|
||||
<use.hip>OFF</use.hip>
|
||||
<cudf.version>23.08.0</cudf.version>
|
||||
<spark.rapids.version>23.08.1</spark.rapids.version>
|
||||
<cudf.classifier>cuda11</cudf.classifier>
|
||||
|
||||
@ -104,6 +104,8 @@
|
||||
<argument>${log.capi.invocation}</argument>
|
||||
<argument>--use-cuda</argument>
|
||||
<argument>${use.cuda}</argument>
|
||||
<argument>--use-hip</argument>
|
||||
<argument>${use.hip}</argument>
|
||||
</arguments>
|
||||
<workingDirectory>${user.dir}</workingDirectory>
|
||||
</configuration>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Created by bobwang on 2021/9/8.
|
||||
//
|
||||
|
||||
#ifndef XGBOOST_USE_CUDA
|
||||
#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
#include <jni.h>
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
#include "../../../../src/common/device_helpers.cuh"
|
||||
#elif defined(XGBOOST_USE_HIP)
|
||||
#include "../../../../src/common/device_helpers.hip.h"
|
||||
#endif
|
||||
#include "../../../../src/common/cuda_pinned_allocator.h"
|
||||
#include "../../../../src/data/array_interface.h"
|
||||
#include "jvm_utils.h"
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
#include "xgboost4j-gpu.cu"
|
||||
#endif
|
||||
@ -15,6 +15,10 @@ class BuildConfiguration: # pylint: disable=R0902
|
||||
use_cuda: bool = False
|
||||
# Whether to enable NCCL
|
||||
use_nccl: bool = False
|
||||
# Whether to enable HIP
|
||||
use_hip: bool = False
|
||||
# Whether to enable RCCL
|
||||
use_rccl: bool = False
|
||||
# Whether to enable HDFS
|
||||
use_hdfs: bool = False
|
||||
# Whether to enable Azure Storage
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user