From c7bdc7a64f8dfbad94a286849695413a0e8acb68 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 8 Aug 2022 17:11:06 -0400 Subject: [PATCH 1/2] add variant info to output message --- deepmd/train/run_options.py | 1 + source/CMakeLists.txt | 3 +++ source/api_cc/src/DeepPot.cc | 7 +++++++ source/config/run_config.ini | 1 + 4 files changed, 12 insertions(+) diff --git a/deepmd/train/run_options.py b/deepmd/train/run_options.py index 8cd095323d..98ce9d3a9d 100644 --- a/deepmd/train/run_options.py +++ b/deepmd/train/run_options.py @@ -47,6 +47,7 @@ f"source commit: {GLOBAL_CONFIG['git_hash']}", f"source commit at: {GLOBAL_CONFIG['git_date']}", f"build float prec: {global_float_prec}", + f"build variant: {GLOBAL_CONFIG['dp_variant']}", f"build with tf inc: {GLOBAL_CONFIG['tf_include_dir']}", f"build with tf lib: {GLOBAL_CONFIG['tf_libs'].replace(';', _sep)}" # noqa ) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 9f6351a911..9f276c39a0 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -53,6 +53,7 @@ message(STATUS "Supported model version: ${MODEL_VERSION}") if (USE_ROCM_TOOLKIT AND USE_CUDA_TOOLKIT) message (FATAL_ERROR "Devices that have both ROCM and CUDA are not currently supported") endif() +set(DP_VARIANT "cpu") # define USE_CUDA_TOOLKIT if (USE_CUDA_TOOLKIT) @@ -60,6 +61,7 @@ if (USE_CUDA_TOOLKIT) find_package(CUDA REQUIRED) add_definitions("-DGOOGLE_CUDA") message(STATUS "Found CUDA in ${CUDA_TOOLKIT_ROOT_DIR}, build nv GPU support") + set(DP_VARIANT "cuda") else() message(STATUS "Will not build nv GPU support") endif(USE_CUDA_TOOLKIT) @@ -70,6 +72,7 @@ if (USE_ROCM_TOOLKIT) add_definitions("-DTENSORFLOW_USE_ROCM") add_compile_definitions(__HIP_PLATFORM_HCC__) message(STATUS "Found ROCM in ${ROCM_ROOT}, build AMD GPU support") + set(DP_VARIANT "rocm") else() message(STATUS "Will not build AMD GPU support") endif (USE_ROCM_TOOLKIT) diff --git a/source/api_cc/src/DeepPot.cc b/source/api_cc/src/DeepPot.cc index 2b84b2405e..931378b079 100644 --- a/source/api_cc/src/DeepPot.cc +++ b/source/api_cc/src/DeepPot.cc @@ -248,6 +248,13 @@ print_summary(const std::string &pre) const std::cout << pre << "source commit at: " + global_git_date << std::endl; std::cout << pre << "surpport model ver.:" + global_model_version << std::endl; std::cout << pre << "build float prec: " + global_float_prec << std::endl; +#if defined(GOOGLE_CUDA) + std::cout << pre << "build variant: " + "cuda" << std::endl; +#elif defined(TENSORFLOW_USE_ROCM) + std::cout << pre << "build variant: " + "rocm" << std::endl; +#else + std::cout << pre << "build variant: " + "cpu" << std::endl; +#endif std::cout << pre << "build with tf inc: " + global_tf_include_dir << std::endl; std::cout << pre << "build with tf lib: " + global_tf_lib << std::endl; std::cout << pre << "set tf intra_op_parallelism_threads: " << num_intra_nthreads << std::endl; diff --git a/source/config/run_config.ini b/source/config/run_config.ini index 87f54ef169..3f0a7a33a8 100644 --- a/source/config/run_config.ini +++ b/source/config/run_config.ini @@ -9,3 +9,4 @@ TF_LIBS = @TensorFlow_LIBRARY@ TF_VERSION = @TENSORFLOW_VERSION@ TF_CXX11_ABI_FLAG = @OP_CXX_ABI@ MODEL_VERSION=@MODEL_VERSION@ +DP_VARIANT=@DP_VARIANT@ From 3cfbe7b65c11a36df410a887b70e43e5803a55a3 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Mon, 8 Aug 2022 17:47:24 -0400 Subject: [PATCH 2/2] fix compilation error Signed-off-by: Jinzhe Zeng --- source/api_cc/src/DeepPot.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/api_cc/src/DeepPot.cc b/source/api_cc/src/DeepPot.cc index 931378b079..0dda00cb27 100644 --- a/source/api_cc/src/DeepPot.cc +++ b/source/api_cc/src/DeepPot.cc @@ -249,11 +249,11 @@ print_summary(const std::string &pre) const std::cout << pre << "surpport model ver.:" + global_model_version << std::endl; std::cout << pre << "build float prec: " + global_float_prec << std::endl; #if defined(GOOGLE_CUDA) - std::cout << pre << "build variant: " + "cuda" << std::endl; + std::cout << pre << "build variant: cuda" << std::endl; #elif defined(TENSORFLOW_USE_ROCM) - std::cout << pre << "build variant: " + "rocm" << std::endl; + std::cout << pre << "build variant: rocm" << std::endl; #else - std::cout << pre << "build variant: " + "cpu" << std::endl; + std::cout << pre << "build variant: cpu" << std::endl; #endif std::cout << pre << "build with tf inc: " + global_tf_include_dir << std::endl; std::cout << pre << "build with tf lib: " + global_tf_lib << std::endl;