diff --git a/v10a.sh b/v10a.sh new file mode 100755 index 0000000..3575820 --- /dev/null +++ b/v10a.sh @@ -0,0 +1,364 @@ +set -eou pipefail + +export WORK_DIR=/rust/cwpears/cudas +SIMULTANEOUS_DOWNLOADS=4 +SIMULTANEOUS_EXTRACTS=2 + +URLS=( +https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux +https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run +) + +function cuda_release { + version_re='/([0-9]+\.[0-9]+\.*[0-9]*)/' + if [[ $1 =~ $version_re ]]; then + echo ${BASH_REMATCH[1]} + else + echo "no match" + exit 1 + fi +} + +function download { + wget --no-check-certificate -P "$WORK_DIR" -c $1 +} +export -f download # export to subshells + + +function extract { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + echo "$fname -> $dirname" + rm -rf "$dirname" + + if [[ $1 == *"1.105"* ]]; then + $SHELL "$fname" --silent --override --toolkit --toolkitpath="$dirname" --defaultroot="$dirname" + else + $SHELL "$fname" --silent --override --toolkit --toolkitpath="$dirname" + fi +} +export -f extract # export to subshells + +function cuda_version { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + version=$(grep -roh -E 'CUDA_VERSION ([0-9]+)' $dirname/include | grep -o -E '[0-9]+') + echo CUDA_VERSION '(CUDA API Version)' $version +} + +function path_size { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + if stat -t $dirname/$2 >/dev/null 2>&1; then # tests if glob matches anything + du -sLc $dirname/$2 | tail -n1 | cut -f1 + else + echo 0 + fi +} + +function so_size { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + du -sLc $dirname/lib64/$2*.so | tail -n1 | cut -f1 +} + +function dir_syms { + shopt -s globstar + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + nm -D --defined-only $dirname/lib64/$2.so | wc -l +} + +function cuda_size { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + du -s "$dirname" | cut -f1 +} + +function cusparse_size { + so_size $1 libcusparse +} + +function cublas_size { + so_size $1 libcublas +} + +function nvcc_size { + path_size $1 bin/nvcc +} + +function cufft_size { + so_size $1 libcufft +} + +function curand_size { + so_size $1 libcurand +} + +function cusolver_size { + so_size $1 libcusolver +} + +function npp_size { + so_size $1 libnpp* +} + +function nsight_compute_size { + a=$(path_size $1 NsightCompute-*) + b=$(path_size $1 nsight-compute-*) + echo $a + $b | bc -l +} + +function nsight_systems_size { + a=$(path_size $1 NsightSystems-*) + b=$(path_size $1 nsight-systems-*) + echo $a + $b | bc -l +} + +function cupti_size { + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + du -sLc $dirname/extras/CUPTI/lib64/libcupti*.so | tail -n1 | cut -f1 +} + +function gdb_size { + path_size $1 bin/cuda-gdb* +} + +function cudart_size { + so_size $1 libcudart +} + +function nvrtc_size { + so_size $1 libnvrtc +} + +function nsight_size { + path_size $1 libnsight +} + +function driver_size { + echo 0 +} + +function pct { + echo "x=$1 / $2 * 100; scale=2; x/1" | bc -l +} + +function cusparse_syms { + dir_syms $1 libcusparse +} + +function cublas_syms { + dir_syms $1 libcublas +} + +function cusolver_syms { + dir_syms $1 libcusolver +} + +function cufft_syms { + dir_syms $1 libcufft +} + +function curand_syms { + dir_syms $1 libcurand +} + +function cudart_syms { + dir_syms $1 libcudart +} + +function cupti_syms { + shopt -s globstar + fname="$WORK_DIR"/$(basename $1) + dirname="${fname%.*}" + nm -D --defined-only $dirname/extras/CUPTI/lib64/libcupti*.so | wc -l +} + +function npp_syms { + dir_syms $1 libnpp* +} + + +function sym_table { + printf "${TABLE_START}" + printf "${ROW_START}${HCELL_START}CUDA Release${HCELL_END}" + printf "${HCELL_START}cuSPARSE${HCELL_END}" + printf "${HCELL_START}cuBLAS${HCELL_END}" + printf "${HCELL_START}cuSOLVER${HCELL_END}" + printf "${HCELL_START}cuFFT${HCELL_END}" + printf "${HCELL_START}cuRAND${HCELL_END}" + printf "${HCELL_START}cudart${HCELL_END}" + printf "${HCELL_START}cupti${HCELL_END}" + printf "${HCELL_START}npp${HCELL_END}" + printf "${ROW_END}" + for url in ${URLS[*]}; do + _r=$(cuda_release "$url") + printf "${ROW_START}" + printf "${CELL_START}$_r${CELL_END}" + printf "${CELL_START}$(cusparse_syms $url)${CELL_END}" + printf "${CELL_START}$(cublas_syms $url)${CELL_END}" + printf "${CELL_START}$(cusolver_syms $url)${CELL_END}" + printf "${CELL_START}$(cufft_syms $url)${CELL_END}" + printf "${CELL_START}$(curand_syms $url)${CELL_END}" + printf "${CELL_START}$(cudart_syms $url)${CELL_END}" + printf "${CELL_START}$(cupti_syms $url)${CELL_END}" + printf "${CELL_START}$(npp_syms $url)${CELL_END}" + printf "$ROW_END" + done + printf "${TABLE_END}" +} + +function sym_html { + TABLE_START="
CUDA Release | cuSPARSE Version | cuBLAS Version |
---|---|---|
$_r | $_cs_v | $_cb_v |
CUDA Release | " -echo -n "Size (K) | " -echo -n "cuSPARSE Size | " -echo -n "cuBLAS Size | " -echo -n "nvcc Size | " -echo -n "cuFFT Size | " -echo -n "cuRAND Size | " -echo -n "cuSOLVER Size | " -echo -n "npp Size | " -echo -n "Nsight Compute | " -echo -n "Nsight Systems | " -echo -n "cuPTI Size | " -echo -n "CUDA GDB Size | " -echo -n "cudart Size | " -echo -n "nvrtc Size | " -echo -n "nsight Size | " -echo -n "driver Size | " -echo "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$_r | " - echo -n "$_c_s | " - echo -n "$_cs_s ("$(pct $_cs_s $_c_s)"%) | " - echo -n "$_cb_s ("$(pct $_cb_s $_c_s)"%) | " - echo -n "$_nvcc_s ("$(pct $_nvcc_s $_c_s)"%) | " - echo -n "$_cufft_s ("$(pct $_cufft_s $_c_s)"%) | " - echo -n "$_curand_s ("$(pct $_curand_s $_c_s)"%) | " - echo -n "$_cusolver_s ("$(pct $_cusolver_s $_c_s)"%) | " - echo -n "$_npp_s ("$(pct $_npp_s $_c_s)"%) | " - echo -n "$_nsight_compute_s ("$(pct $_nsight_systems_s $_c_s)"%) | " - echo -n "$_nsight_systems_s ("$(pct $_nsight_compute_s $_c_s)"%) | " - echo -n "$_cupti_s ("$(pct $_cupti_s $_c_s)"%) | " - echo -n "$_gdb_s ("$(pct $_gdb_s $_c_s)"%) | " - echo -n "$_cudart_s ("$(pct $_cudart_s $_c_s)"%) | " - echo -n "$_nvrtc_s ("$(pct $_nvrtc_s $_c_s)"%) | " - echo -n "$_nsight_s ("$(pct $_nsight_s $_c_s)"%) | " - echo -n "$_driver_s ("$(pct $_driver_s $_c_s)"%) | " - echo "