@@ -37,49 +37,49 @@ gpu_targets=""
3737# check if we have a modern version of getopt that can handle whitespace and long parameters
3838getopt -T
3939if [[ $? -eq 4 ]]; then
40- GETOPT_PARSE=$( getopt --name " ${0} " --longoptions help,mpi,test,rocm_home:,rccl_home:,mpi_home:,hip_compiler:,gpu_targets: --options hmt -- " $@ " )
40+ GETOPT_PARSE=$( getopt --name " ${0} " --longoptions help,mpi,test,rocm_home:,rccl_home:,mpi_home:,hip_compiler:,gpu_targets: --options hmt -- " $@ " )
4141else
42- echo " Need a new version of getopt"
43- exit 1
42+ echo " Need a new version of getopt"
43+ exit 1
4444fi
4545
4646if [[ $? -ne 0 ]]; then
47- echo " getopt invocation failed; could not parse the command line" ;
48- exit 1
47+ echo " getopt invocation failed; could not parse the command line" ;
48+ exit 1
4949fi
5050
5151eval set -- " ${GETOPT_PARSE} "
5252
5353while true ; do
54- case " ${1} " in
55- -h|--help)
56- display_help
57- exit 0 ;;
58- -m|--mpi)
59- mpi_enabled=true
60- shift ;;
61- -t|--test)
62- run_tests=true
63- shift ;;
64- --rocm_home)
65- rocm_dir=${2}
66- shift 2 ;;
67- --rccl_home)
68- rccl_dir=${2}
69- shift 2 ;;
70- --mpi_home)
71- mpi_dir=${2}
72- shift 2 ;;
73- --hip_compiler)
74- hip_compiler=${2}
75- shift 2 ;;
76- --gpu_targets)
77- gpu_targets=${2}
78- shift 2 ;;
79- --) shift ; break ;;
80- * ) echo " Unexpected command line parameter received; aborting" ;
81- exit 1 ;;
82- esac
54+ case " ${1} " in
55+ -h|--help)
56+ display_help
57+ exit 0 ;;
58+ -m|--mpi)
59+ mpi_enabled=true
60+ shift ;;
61+ -t|--test)
62+ run_tests=true
63+ shift ;;
64+ --rocm_home)
65+ rocm_dir=${2}
66+ shift 2 ;;
67+ --rccl_home)
68+ rccl_dir=${2}
69+ shift 2 ;;
70+ --mpi_home)
71+ mpi_dir=${2}
72+ shift 2 ;;
73+ --hip_compiler)
74+ hip_compiler=${2}
75+ shift 2 ;;
76+ --gpu_targets)
77+ gpu_targets=${2}
78+ shift 2 ;;
79+ --) shift ; break ;;
80+ * ) echo " Unexpected command line parameter received; aborting" ;
81+ exit 1 ;;
82+ esac
8383done
8484
8585# throw error code after running a command in the install script
@@ -101,49 +101,54 @@ build_dir=./build
101101rm -rf ${build_dir}
102102
103103if [[ -z ${rocm_dir} ]]; then
104- echo " ROCM_PATH does not exist at ${rocm_dir} . Defaulting to /opt/rocm"
105- rocm_dir=/opt/rocm
104+ echo " [WARN] ROCM_PATH does not exist at ${rocm_dir} . Defaulting to /opt/rocm"
105+ rocm_dir=/opt/rocm
106106fi
107107
108108if ! command -v ${hip_compiler} 2>&1 > /dev/null ; then
109- echo " HIP Compiler does not exist at ${hip_compiler} . Please check the path."
110- echo " Defaulting to /opt/rocm/bin/amdclang++"
111- hip_compiler=${rocm_dir} /bin/amdclang++
109+ echo " [WARN] HIP Compiler does not exist at ${hip_compiler} . Please check the path."
110+ echo " [WARN] - Falling back to ${rocm_dir} /bin/amdclang++"
111+ hip_compiler=${rocm_dir} /bin/amdclang++
112+
113+ if ! command -v ${hip_compiler} 2>&1 > /dev/null ; then
114+ echo " [WARN] ${hip_compiler} does not exist. Please be advised."
115+ echo " [WARN] - Falling back to ${rocm_dir} /bin/hipcc"
116+ hip_compiler=${rocm_dir} /bin/hipcc
112117
113118 if ! command -v ${hip_compiler} 2>&1 > /dev/null ; then
114- echo " ${hip_compiler} does not exist. Please be advised."
115- echo " Defaulting to /opt/rocm/bin/hipcc"
116- hip_compiler=${rocm_dir} /bin/hipcc
117-
118- if ! command -v ${hip_compiler} 2>&1 > /dev/null ; then
119- echo " ${hip_compiler} does not exist!. Please check your ROCm installation."
120- echo " Cannot proceed with building rccl-tests!"
121- exit 1
122- fi
119+ echo " [ERROR] ${hip_compiler} does not exist!. Please check your ROCm installation." >&2
120+ echo " [ERROR] Cannot proceed with building rccl-tests!" >&2
121+ exit 1
123122 fi
123+ fi
124124fi
125+ echo " [INFO] Compiling with ${hip_compiler} "
125126
126127if [[ -n ${gpu_targets} ]]; then
127- GPU_TARGETS=" GPU_TARGETS=${gpu_targets} "
128+ GPU_TARGETS=" GPU_TARGETS=${gpu_targets} "
128129fi
129130
130131if ($mpi_enabled ); then
131- if [[ ${mpi_dir} == " " ]]; then
132- echo " MPI flag enabled but path to MPI installation not specified. See --mpi_home command line argument."
133- exit 1
134- else
135- make NCCL_HOME=${rccl_dir} CUSTOM_RCCL_LIB=${rccl_dir} /lib/librccl.so MPI=1 MPI_HOME=${mpi_dir} HIPCC=${hip_compiler} ${GPU_TARGETS} -j$( nproc)
136- fi
132+ if [[ ${mpi_dir} == " " ]]; then
133+ echo " [ERROR] MPI flag enabled but path to MPI installation not specified. See --mpi_home command line argument." >&2
134+ exit 1
135+ else
136+ echo " [INFO] Compiling with MPI support (Using MPI from ${mpi_dir} )"
137+ echo
138+ make NCCL_HOME=${rccl_dir} CUSTOM_RCCL_LIB=${rccl_dir} /lib/librccl.so MPI=1 MPI_HOME=${mpi_dir} HIPCC=${hip_compiler} ${GPU_TARGETS} -j$( nproc)
139+ fi
137140else
138- make NCCL_HOME=${rccl_dir} CUSTOM_RCCL_LIB=${rccl_dir} /lib/librccl.so HIP_COMPILER=${hip_compiler} ${GPU_TARGETS} -j$( nproc)
141+ echo " [INFO] Compiling without MPI support (MPI support requires -m and --mpi_home)"
142+ echo
143+ make NCCL_HOME=${rccl_dir} CUSTOM_RCCL_LIB=${rccl_dir} /lib/librccl.so HIPCC=${hip_compiler} ${GPU_TARGETS} -j$( nproc)
139144fi
140145check_exit_code " $? "
141146
142147# Optionally, run tests if they're enabled.
143148if ($run_tests ); then
144- if ($mpi_enabled ); then
145- cd test ; LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${rccl_dir} /lib:${mpi_dir} /lib PATH=$PATH :${mpi_dir} /bin python3 -m pytest
146- else
147- cd test ; LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${rccl_dir} /lib python3 -m pytest -k " not MPI"
148- fi
149+ if ($mpi_enabled ); then
150+ cd test ; LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${rccl_dir} /lib:${mpi_dir} /lib PATH=$PATH :${mpi_dir} /bin python3 -m pytest
151+ else
152+ cd test ; LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${rccl_dir} /lib python3 -m pytest -k " not MPI"
153+ fi
149154fi
0 commit comments