Files
blis/test/supmt/runme.sh
Field G. Van Zee 1a284828d1 Support multithreading within the sup framework.
Details:
- Added multithreading support to the sup framework (via either OpenMP
  or pthreads). Both variants 1n and 2m now have the appropriate
  threading infrastructure, including data partitioning logic, to
  parallelize computation. This support handles all four combinations
  of packing on matrices A and B (neither, A only, B only, or both).
  This implementation tries to be a little smarter when automatic
  threading is requested (e.g. via BLIS_NUM_THREADS) in that it will
  recalculate the factorization in units of micropanels (rather than
  using the raw dimensions) in bli_l3_sup_int.c, when the final
  problem shape is known and after threads have already been spawned.
- Implemented bli_?packm_sup_var2(), which packs to conventional row-
  or column-stored matrices. (This is used for the rrc and crc storage
  cases.) Previously, copym was used, but that would no longer suffice
  because it could not be parallelized.
- Minor reorganization of packing-related sup functions. Specifically,
  bli_packm_sup_init_mem_[ab]() are called from within packm_sup_[ab]()
  instead of from the variant functions. This has the effect of making
  the variant functions more readable.
- Added additional bli_thrinfo_set_*() static functions to bli_thrinfo.h
  and inserted usage of these functions within bli_thrinfo_init(), which
  previously was accessing thrinfo_t fields via the -> operator.
- Renamed bli_partition_2x2() to bli_thread_partition_2x2().
- Added an auto_factor field to the rntm_t struct in order to track
  whether automatic thread factorization was originally requested.
- Added new test drivers in test/supmt that perform multithreaded sup
  tests, as well as appropriate octave/matlab scripts to plot the
  resulting output files.
- Added additional language to docs/Multithreading.md to make it clear
  that specifying any BLIS_*_NT variable, even if it is set to 1, will
  be considered manual specification for the purposes of determining
  whether to auto-factorize via BLIS_NUM_THREADS.
- Minor comment updates.
AMD-Internal: [CPUPL-713]

Change-Id: I9536648e7befac4d2dc17805e44ef34470961662
2020-03-13 01:09:29 -04:00

189 lines
4.1 KiB
Bash
Executable File

#!/bin/bash
# File pefixes.
exec_root="test"
out_root="output"
sys="blis"
#sys="lonestar5"
#sys="ul252"
#sys="ul264"
if [ ${sys} = "blis" ]; then
export GOMP_CPU_AFFINITY="0-3"
nt=4
elif [ ${sys} = "lonestar5" ]; then
export GOMP_CPU_AFFINITY="0-23"
nt=24
elif [ ${sys} = "ul252" ]; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/field/intel/mkl/lib/intel64"
export GOMP_CPU_AFFINITY="0-51"
nt=52
elif [ ${sys} = "ul264" ]; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/field/intel/mkl/lib/intel64"
export GOMP_CPU_AFFINITY="0-63"
nt=64
fi
# Delay between test cases.
delay=0.02
# Threadedness to test.
threads="mt"
# Datatypes to test.
#dts="d s"
dts="d"
# Operations to test.
ops="gemm"
# Transpose combintions to test.
trans="nn nt tn tt"
# Storage combinations to test.
#stors="rrr rrc rcr rcc crr crc ccr ccc"
stors="rrr ccc"
# Problem shapes to test.
shapes="sll lsl lls lss sls ssl lll"
# FGVZ: figure out how to probe what's in the directory and
# execute everything that's there?
sms="6"
sns="8"
sks="10"
# Implementations to test.
impls="vendor blissup blislpab openblas eigen"
#impls="vendor"
#impls="blissup"
#impls="blislpab"
#impls="openblas"
#impls="eigen"
# Save a copy of GOMP_CPU_AFFINITY so that if we have to unset it, we can
# restore the value.
GOMP_CPU_AFFINITYsave=${GOMP_CPU_AFFINITY}
# Example: test_dgemm_nn_rrc_m6npkp_blissup_st.x
for th in ${threads}; do
for dt in ${dts}; do
for op in ${ops}; do
for tr in ${trans}; do
for st in ${stors}; do
for sh in ${shapes}; do
for sm in ${sms}; do
for sn in ${sns}; do
for sk in ${sks}; do
for im in ${impls}; do
if [ "${im:0:4}" = "blis" ]; then
unset OMP_NUM_THREADS
export BLIS_NUM_THREADS=${nt}
elif [ "${im}" = "openblas" ]; then
unset OMP_NUM_THREADS
export OPENBLAS_NUM_THREADS=${nt}
elif [ "${im}" = "eigen" ]; then
export OMP_NUM_THREADS=${nt}
elif [ "${im}" = "vendor" ]; then
unset OMP_NUM_THREADS
export MKL_NUM_THREADS=${nt}
fi
# Multithreaded OpenBLAS seems to have a problem
# running properly if GOMP_CPU_AFFINITY is set.
# So we temporarily unset it here if we are about
# to execute OpenBLAS, but otherwise restore it.
if [ ${im} = "openblas" ]; then
unset GOMP_CPU_AFFINITY
else
export GOMP_CPU_AFFINITY="${GOMP_CPU_AFFINITYsave}"
fi
# Limit execution of non-BLIS implementations to
# rrr/ccc storage cases.
if [ "${im:0:4}" != "blis" ] && \
[ "${st}" != "rrr" ] && \
[ "${st}" != "ccc" ]; then
continue;
fi
# Further limit execution of libxsmm to
# ccc storage cases.
if [ "${im:0:7}" = "libxsmm" ] && \
[ "${st}" != "ccc" ]; then
continue;
fi
# Extract the shape chars for m, n, k.
chm=${sh:0:1}
chn=${sh:1:1}
chk=${sh:2:1}
# Construct the shape substring (e.g. m6npkp)
shstr=""
if [ ${chm} = "s" ]; then
shstr="${shstr}m${sm}"
else
shstr="${shstr}mp"
fi
if [ ${chn} = "s" ]; then
shstr="${shstr}n${sn}"
else
shstr="${shstr}np"
fi
if [ ${chk} = "s" ]; then
shstr="${shstr}k${sk}"
else
shstr="${shstr}kp"
fi
# Ex: test_dgemm_nn_rrc_m6npkp_blissup_st.x
# Construct the name of the test executable.
exec_name="${exec_root}_${dt}${op}_${tr}_${st}_${shstr}_${im}_${th}.x"
# Construct the name of the output file.
out_file="${out_root}_${th}_${dt}${op}_${tr}_${st}_${shstr}_${im}.m"
echo "Running (nt = ${nt}) ./${exec_name} > ${out_file}"
# Run executable.
./${exec_name} > ${out_file}
sleep ${delay}
done
done
done
done
done
done
done
done
done
done