2019-05-16 16:16:18 +00:00
#!/bin/bash
2023-05-25 16:08:54 -06:00
# Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved.
2019-05-16 16:16:18 +00:00
2023-06-22 14:30:44 -06:00
# #################################################
# global variables
# #################################################
ROCM_PATH = ${ ROCM_PATH : = "/opt/rocm" }
# Default values
build_address_sanitizer = false
2023-09-22 13:05:11 +00:00
build_bfd = false
2023-08-22 09:14:49 -04:00
build_freorg_bkwdcomp = false
2023-06-22 14:30:44 -06:00
build_local_gpu_only = false
2024-01-09 13:29:47 -06:00
build_amdgpu_targets = ""
2023-06-22 14:30:44 -06:00
build_package = false
build_release = true
build_static = false
build_tests = false
build_verbose = 0
clean_build = true
collective_trace = true
enable_ninja = ""
install_dependencies = false
install_library = false
2023-08-02 09:45:18 -06:00
msccl_kernel_enabled = true
2024-01-18 15:07:16 -07:00
num_parallel_jobs = $( nproc)
2023-06-22 14:30:44 -06:00
npkit_enabled = false
2024-02-27 15:46:15 -07:00
roctx_enabled = false
2023-06-22 14:30:44 -06:00
run_tests = false
run_tests_all = false
time_trace = false
2019-05-16 16:16:18 +00:00
# #################################################
# helper functions
# #################################################
function display_help( )
{
echo "RCCL build & installation helper script"
2023-06-22 14:30:44 -06:00
echo " Options:"
2023-05-25 16:08:54 -06:00
echo " --address-sanitizer Build with address sanitizer enabled"
echo " -d|--dependencies Install RCCL depdencencies"
echo " --debug Build debug library"
2023-09-22 13:05:11 +00:00
echo " --enable_backtrace Build with custom backtrace support"
2023-06-21 16:16:09 -04:00
echo " --disable-colltrace Build without collective trace"
2023-08-02 09:45:18 -06:00
echo " --disable-msccl-kernel Build without MSCCL kernels"
2023-06-22 14:30:44 -06:00
echo " -f|--fast Quick-build RCCL (local gpu arch only, no backtrace, and collective trace support)"
2023-05-25 16:08:54 -06:00
echo " -h|--help Prints this help message"
echo " -i|--install Install RCCL library (see --prefix argument below)"
2023-06-22 14:30:44 -06:00
echo " -j|--jobs Specify how many parallel compilation jobs to run ( $num_parallel_jobs by default) "
echo " -l|--local_gpu_only Only compile for local GPU architecture"
2024-01-09 13:29:47 -06:00
echo " --amdgpu_targets Only compile for specified GPU architecture(s). For multiple targets, seperate by ';' (builds for all supported GPU architectures by default)"
2023-05-25 16:08:54 -06:00
echo " --no_clean Don't delete files if they already exist"
echo " --npkit-enable Compile with npkit enabled"
2024-02-27 15:46:15 -07:00
echo " --roctx-enable Compile with roctx enabled (example usage: rocprof --roctx-trace ./rccl-program)"
2023-05-25 16:08:54 -06:00
echo " -p|--package_build Build RCCL package"
echo " --prefix Specify custom directory to install RCCL to (default: /opt/rocm)"
echo " --rm-legacy-include-dir Remove legacy include dir Packaging added for file/folder reorg backward compatibility"
echo " --run_tests_all Run all rccl unit tests (must be built already)"
echo " -r|--run_tests_quick Run small subset of rccl unit tests (must be built already)"
echo " --static Build RCCL as a static library instead of shared library"
echo " -t|--tests_build Build rccl unit tests, but do not run"
2023-06-14 09:17:51 -06:00
echo " --time-trace Plot the build time of RCCL"
2023-05-25 16:08:54 -06:00
echo " --verbose Show compile commands"
2019-05-16 16:16:18 +00:00
}
# #################################################
# Parameter parsing
# #################################################
# check if we have a modern version of getopt that can handle whitespace and long parameters
getopt -T
if [ [ $? -eq 4 ] ] ; then
2024-02-27 15:46:15 -07:00
GETOPT_PARSE = $( getopt --name " ${ 0 } " --options dfhij:lprt --longoptions address-sanitizer,dependencies,debug,enable_backtrace,disable-colltrace,disable-msccl-kernel,fast,help,install,jobs:,local_gpu_only,amdgpu_targets:,no_clean,npkit-enable,roctx-enable,package_build,prefix:,rm-legacy-include-dir,run_tests_all,run_tests_quick,static,tests_build,time-trace,verbose -- " $@ " )
2019-05-16 16:16:18 +00:00
else
echo "Need a new version of getopt"
exit 1
fi
if [ [ $? -ne 0 ] ] ; then
echo "getopt invocation failed; could not parse the command line" ;
exit 1
fi
eval set -- " ${ GETOPT_PARSE } "
while true; do
case " ${ 1 } " in
2023-08-02 09:45:18 -06:00
--address-sanitizer) build_address_sanitizer = true; shift ; ;
-d | --dependencies) install_dependencies = true; shift ; ;
--debug) build_release = false; shift ; ;
2023-10-19 16:35:10 -06:00
--enable_backtrace) build_bfd = true; shift ; ;
2023-08-02 09:45:18 -06:00
--disable-colltrace) collective_trace = false; shift ; ;
--disable-msccl-kernel) msccl_kernel_enabled = false; shift ; ;
2023-10-19 16:35:10 -06:00
-f | --fast) build_local_gpu_only = true; collective_trace = false; msccl_kernel_enabled = false; shift ; ;
2023-08-02 09:45:18 -06:00
-h | --help) display_help; exit 0 ; ;
-i | --install) install_library = true; shift ; ;
-j | --jobs) num_parallel_jobs = ${ 2 } ; shift 2 ; ;
-l | --local_gpu_only) build_local_gpu_only = true; shift ; ;
2024-01-09 13:29:47 -06:00
--amdgpu_targets) build_amdgpu_targets = ${ 2 } ; shift 2 ; ;
2023-08-02 09:45:18 -06:00
--no_clean) clean_build = false; shift ; ;
--npkit-enable) npkit_enabled = true; shift ; ;
2024-02-27 15:46:15 -07:00
--roctx-enable) roctx_enabled = true; shift ; ;
2023-08-02 09:45:18 -06:00
-p | --package_build) build_package = true; shift ; ;
--prefix) install_prefix = ${ 2 } ; shift 2 ; ;
--rm-legacy-include-dir) build_freorg_bkwdcomp = false; shift ; ;
-r | --run_tests_quick) run_tests = true; shift ; ;
--run_tests_all) run_tests = true; run_tests_all = true; shift ; ;
--static) build_static = true; shift ; ;
-t | --tests_build) build_tests = true; shift ; ;
--time-trace) time_trace = true; shift ; ;
--verbose) build_verbose = 1; shift ; ;
2019-06-25 17:25:21 -06:00
--) shift ; break ; ;
*) echo "Unexpected command line parameter received; aborting" ;
exit 1
; ;
2019-05-16 16:16:18 +00:00
esac
2023-05-25 16:08:54 -06:00
done
2019-05-16 16:16:18 +00:00
2021-02-12 22:14:30 +05:30
ROCM_BIN_PATH = $ROCM_PATH /bin
2019-06-25 17:25:21 -06:00
2020-06-05 11:04:03 -06:00
# /etc/*-release files describe the system
if [ [ -e "/etc/os-release" ] ] ; then
source /etc/os-release
elif [ [ -e "/etc/centos-release" ] ] ; then
OS_ID = $( cat /etc/centos-release | awk '{print tolower($1)}' )
VERSION_ID = $( cat /etc/centos-release | grep -oP '(?<=release )[^ ]*' | cut -d "." -f1)
else
echo "This script depends on the /etc/*-release files"
exit 2
fi
2020-06-04 11:58:27 -06:00
# throw error code after running a command in the install script
check_exit_code( )
{
if ( ( $1 != 0 ) ) ; then
exit $1
fi
}
2021-06-04 09:46:04 -06:00
if [ [ " $build_release " = = true ] ] ; then
2022-12-13 21:45:57 +00:00
unit_test_path = "./build/release/test/rccl-UnitTests"
2021-06-04 09:46:04 -06:00
else
2022-12-13 21:45:57 +00:00
unit_test_path = "./build/debug/test/rccl-UnitTests"
2021-06-04 09:46:04 -06:00
fi
if ( $run_tests ) && [ [ -f $unit_test_path ] ] ; then
if [ [ " $build_tests " = = false ] ] ; then
clean_build = false
fi
fi
2019-05-22 15:32:32 -06:00
# #################################################
# prep
# #################################################
# ensure a clean build environment
2020-07-21 12:19:47 -06:00
if ( $clean_build ) ; then
if [ [ " ${ build_release } " = = true ] ] ; then
rm -rf build/release
else
rm -rf build/debug
fi
2019-05-20 16:51:14 +00:00
fi
2019-05-16 16:16:18 +00:00
2019-05-22 15:32:32 -06:00
# Create and go to the build directory.
mkdir -p build; cd build
if ( $build_release ) ; then
mkdir -p release; cd release
else
mkdir -p debug; cd debug
fi
# build type
if [ [ " ${ build_release } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DCMAKE_BUILD_TYPE=Release "
else
cmake_common_options = " ${ cmake_common_options } -DCMAKE_BUILD_TYPE=Debug "
fi
2023-05-25 16:08:54 -06:00
# Address sanitizer
if [ [ " ${ build_address_sanitizer } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DBUILD_ADDRESS_SANITIZER=ON "
2020-08-06 11:19:43 -06:00
fi
2023-05-25 16:08:54 -06:00
# Backtrace support
2023-09-22 13:05:11 +00:00
if [ [ " ${ build_bfd } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DBUILD_BFD=ON "
2023-05-25 16:08:54 -06:00
fi
# Backward compatibility wrappers
2022-03-08 17:32:02 +00:00
if [ [ " ${ build_freorg_bkwdcomp } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=ON "
else
cmake_common_options = " ${ cmake_common_options } -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF "
fi
2023-05-25 16:08:54 -06:00
# Build local GPU arch only
if [ [ " $build_local_gpu_only " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DBUILD_LOCAL_GPU_TARGET_ONLY=ON "
fi
2024-01-09 13:29:47 -06:00
# Build for specified GPU target(s) only
if [ [ ! -z " $build_amdgpu_targets " ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DAMDGPU_TARGETS= ${ build_amdgpu_targets } "
fi
2023-05-25 16:08:54 -06:00
# shared vs static
if [ [ " ${ build_static } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DBUILD_SHARED_LIBS=OFF "
2019-08-23 22:02:42 +00:00
fi
2023-06-21 16:16:09 -04:00
# Disable collective trace
if [ [ " ${ collective_trace } " = = false ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DCOLLTRACE=OFF "
fi
2020-06-05 11:04:03 -06:00
2023-08-02 09:45:18 -06:00
if [ [ " ${ msccl_kernel_enabled } " = = false ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DENABLE_MSCCL_KERNEL=OFF "
fi
2023-05-25 16:08:54 -06:00
# Install dependencies
2020-06-05 11:04:03 -06:00
if ( $install_dependencies ) ; then
2020-09-10 17:27:22 -06:00
cmake_common_options = " ${ cmake_common_options } -DINSTALL_DEPENDENCIES=ON "
2019-08-23 22:02:42 +00:00
fi
2020-09-10 17:27:22 -06:00
2024-02-27 15:46:15 -07:00
# Enable ROCTX
if [ [ " ${ roctx_enabled } " = = true ] ] ; then
cmake_common_options = " ${ cmake_common_options } -DROCTX=ON "
2024-02-08 14:08:24 -07:00
fi
2023-05-25 16:08:54 -06:00
cmake_executable = cmake
case " ${ OS_ID } " in
centos| rhel)
cmake_executable = cmake3
; ;
esac
2023-04-05 08:05:23 -06:00
npkit_options = ""
if ( $npkit_enabled ) ; then
npkit_options = "-DENABLE_NPKIT \
2023-05-24 14:44:01 -06:00
-DENABLE_NPKIT_EVENT_TIME_SYNC_GPU \
-DENABLE_NPKIT_EVENT_TIME_SYNC_CPU \
2023-04-05 08:05:23 -06:00
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_EXIT \
-DENABLE_NPKIT_EVENT_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_REDUCE_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_RECV_REDUCE_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_SEND_EXIT \
-DENABLE_NPKIT_EVENT_DIRECT_SEND_FROM_OUTPUT_ENTRY \
-DENABLE_NPKIT_EVENT_DIRECT_SEND_FROM_OUTPUT_EXIT \
-DENABLE_NPKIT_EVENT_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_RECV_EXIT \
-DENABLE_NPKIT_EVENT_RECV_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_RECV_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_COPY_ENTRY \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_COPY_EXIT \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_RECV_REDUCE_SEND_EXIT \
-DENABLE_NPKIT_EVENT_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_SEND_EXIT \
-DENABLE_NPKIT_EVENT_SEND_FROM_OUTPUT_ENTRY \
-DENABLE_NPKIT_EVENT_SEND_FROM_OUTPUT_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_SIMPLE_WAIT_PEER_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_SIMPLE_WAIT_PEER_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_SIMPLE_REDUCE_OR_COPY_MULTI_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_SIMPLE_REDUCE_OR_COPY_MULTI_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_LL_WAIT_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_LL_WAIT_SEND_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_LL_DATA_PROCESS_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_LL_DATA_PROCESS_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_LL128_WAIT_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_LL128_WAIT_SEND_EXIT \
-DENABLE_NPKIT_EVENT_PRIM_LL128_DATA_PROCESS_ENTRY \
-DENABLE_NPKIT_EVENT_PRIM_LL128_DATA_PROCESS_EXIT \
-DENABLE_NPKIT_EVENT_NET_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_NET_SEND_EXIT \
2023-07-10 09:31:49 -07:00
-DENABLE_NPKIT_EVENT_NET_TEST_ENTRY \
-DENABLE_NPKIT_EVENT_NET_TEST_EXIT \
2023-04-05 08:05:23 -06:00
-DENABLE_NPKIT_EVENT_NET_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_NET_RECV_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_RECV_REDUCE_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_RECV_REDUCE_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_REDUCE_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_REDUCE_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_RING_DIRECT_RECV_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_REDUCE_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_REDUCE_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_BROADCAST_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_UPDOWN_BROADCAST_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_REDUCE_BROADCAST_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_REDUCE_BROADCAST_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_REDUCE_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_REDUCE_EXIT \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_BROADCAST_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_REDUCE_TREE_SPLIT_BROADCAST_EXIT \
-DENABLE_NPKIT_EVENT_SEND_RECV_LOCAL_COPY_ENTRY \
-DENABLE_NPKIT_EVENT_SEND_RECV_LOCAL_COPY_EXIT \
-DENABLE_NPKIT_EVENT_SEND_RECV_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_SEND_RECV_SEND_EXIT \
-DENABLE_NPKIT_EVENT_SEND_RECV_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_SEND_RECV_RECV_EXIT \
2023-06-29 13:59:54 -06:00
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_EXIT \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_RECV_COPY_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_RECV_COPY_SEND_EXIT \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_DIRECT_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_ALL_GATHER_RING_DIRECT_RECV_EXIT \
2023-08-09 08:30:40 +08:00
-DENABLE_NPKIT_EVENT_MSCCL_GENERIC_OP_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_GENERIC_OP_EXIT \
-DENABLE_NPKIT_EVENT_MSCCL_REDUCE_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_REDUCE_EXIT \
2023-09-07 10:38:23 -05:00
-DENABLE_NPKIT_EVENT_MSCCL_SEND_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_SEND_EXIT \
-DENABLE_NPKIT_EVENT_MSCCL_RECV_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_RECV_EXIT \
-DENABLE_NPKIT_EVENT_MSCCL_RUN_ENTRY \
2023-09-29 07:42:17 -06:00
-DENABLE_NPKIT_EVENT_MSCCL_RUN_EXIT \
2023-10-30 10:00:12 -07:00
-DENABLE_NPKIT_EVENT_MSCCL_RECV_REDUCE_COPY_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_RECV_REDUCE_COPY_EXIT \
-DENABLE_NPKIT_EVENT_MSCCL_INIT_ENTRY \
-DENABLE_NPKIT_EVENT_MSCCL_INIT_EXIT \
2023-04-05 08:05:23 -06:00
-DENABLE_NPKIT_PRIM_COLLECT_DATA_PROCESS_TIME"
fi
2020-06-04 11:58:27 -06:00
check_exit_code " $? "
2019-08-23 22:02:42 +00:00
2023-06-14 09:17:51 -06:00
if ( $time_trace ) ; then
build_system = "ninja"
enable_ninja = "-GNinja"
else
build_system = "make"
fi
2022-12-13 21:45:57 +00:00
if ( $build_tests ) || ( ( $run_tests ) && [ [ ! -f ./test/rccl-UnitTests ] ] ) ; then
2024-01-18 15:07:16 -07:00
CXX = $ROCM_BIN_PATH /hipcc $cmake_executable $cmake_common_options -DBUILD_TESTS= ON -DNPKIT_FLAGS= " ${ npkit_options } " -DCMAKE_INSTALL_PREFIX= $ROCM_PATH -DROCM_PATH= $ROCM_PATH -DONLY_FUNCS= " $ONLY_FUNCS " $enable_ninja ../../.
2019-05-22 15:32:32 -06:00
else
2024-01-18 15:07:16 -07:00
CXX = $ROCM_BIN_PATH /hipcc $cmake_executable $cmake_common_options -DBUILD_TESTS= OFF -DNPKIT_FLAGS= " ${ npkit_options } " -DCMAKE_INSTALL_PREFIX= $ROCM_PATH -DROCM_PATH= $ROCM_PATH -DONLY_FUNCS= " $ONLY_FUNCS " $enable_ninja ../../.
2019-05-22 15:32:32 -06:00
fi
2020-06-04 11:58:27 -06:00
check_exit_code " $? "
2019-05-22 15:32:32 -06:00
2019-06-25 17:25:21 -06:00
if ( $install_library ) ; then
2023-06-22 14:30:44 -06:00
VERBOSE = ${ build_verbose } $build_system -j $num_parallel_jobs install
2019-06-25 17:25:21 -06:00
else
2023-06-22 14:30:44 -06:00
VERBOSE = ${ build_verbose } $build_system -j $num_parallel_jobs
2019-06-25 17:25:21 -06:00
fi
2020-06-04 11:58:27 -06:00
check_exit_code " $? "
2019-05-22 15:32:32 -06:00
2019-06-25 17:25:21 -06:00
if ( $build_package ) ; then
make package
2020-06-04 11:58:27 -06:00
check_exit_code " $? "
2019-06-25 17:25:21 -06:00
fi
2019-05-22 15:32:32 -06:00
2019-05-16 16:16:18 +00:00
# Optionally, run tests if they're enabled.
2019-05-22 15:32:32 -06:00
if ( $run_tests ) ; then
2022-12-13 21:45:57 +00:00
if ( test -f "./test/rccl-UnitTests" ) ; then
2020-07-21 12:19:47 -06:00
if ( $run_tests_all ) ; then
2022-12-13 21:45:57 +00:00
./test/rccl-UnitTests
2020-07-21 12:19:47 -06:00
else
2022-12-13 21:45:57 +00:00
./test/rccl-UnitTests --gtest_filter= "AllReduce.*"
2020-07-21 12:19:47 -06:00
fi
2019-05-22 15:32:32 -06:00
else
2022-12-13 21:45:57 +00:00
echo "rccl unit tests have not been built yet; please re-run script with -t to build rccl unit tests."
2019-05-22 15:32:32 -06:00
exit 1
fi
2019-05-16 16:16:18 +00:00
fi
2023-06-14 09:17:51 -06:00
2023-06-21 16:16:09 -04:00
if ( $time_trace ) ; then
search_dir = "../../"
time_trace_dir = $( find " $search_dir " -type d -name "time-trace" -print -quit)
if [ " $time_trace_dir " ] ; then
time_trace_script = " $time_trace_dir /rccl-TimeTrace.sh "
if [ -x " $time_trace_script " ] ; then
echo "Generating RCCL-compile-timeline.html..."
( cd " $time_trace_dir " && ./rccl-TimeTrace.sh)
else
echo " Error: Unable to execute $time_trace_script . Make sure the file has the correct permissions. "
fi
else
echo " Error: time-trace folder not found in $search_dir . "
fi
2023-06-22 14:30:44 -06:00
fi