-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit.sh
executable file
·52 lines (42 loc) · 1.9 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
export CXX=icpx
# to enable higher version of gcc (to compile torch extension)
# https://stackoverflow.com/questions/61590926/how-to-install-gcc-g-9-on-centos-8-docker-centoslatest
source /opt/rh/gcc-toolset-13/enable
source /home/tingqian/tingqian/venv/bin/activate
if ! which icpx > /dev/null; then
# source oneapi & try again
source /opt/intel/oneapi/setvars.sh
if ! which icpx > /dev/null; then
echo "use g++ instead of intel compiler (AMX intrinsic maybe missing)"
export CXX=g++
fi
fi
#https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
export SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# g++ ./test.cpp -O2 -lpthread -march=native -lstdc++
export LD_LIBRARY_PATH=thirdparty/oneDNN/build/install/lib64:$LD_LIBRARY_PATH
# target=a`git rev-parse --short HEAD`.out
function build() {
source=$1
if ! test -f "${source}"; then
echo "cannot find input source cpp file: '$source'"
return
fi
target=a.out
MARCH_OPTS="-mno-avx256-split-unaligned-load -mno-avx256-split-unaligned-store"
MARCH_OPTS=""
COMMON_OPTS="-DENABLE_NUMA -I$SCRIPT_DIR/include -Ithirdparty/oneDNN/build/install/include -Ithirdparty/xbyak/xbyak -Lthirdparty/oneDNN/build/install/lib64 -lpthread -ldnnl -march=native -std=c++14 -lstdc++ -lnuma -fopenmp $MARCH_OPTS"
$CXX $source -O2 $COMMON_OPTS -S -masm=intel -fverbose-asm -o _main.s &&
cat _main.s | c++filt > main.s &&
$CXX $source -O2 $COMMON_OPTS -o $target &&
$CXX $source -O0 $COMMON_OPTS -g -DJIT_DEBUG -o debug.out &&
echo $target is generated &&
echo main.s is generated &&
echo debug.out is generated &&
echo ======== test begin========== &&
echo numactl -N1 --localalloc -C56 ./$target &&
CLFLUSH=1 numactl -N1 --localalloc -C56 ./$target
}
function run1() {
CLFLUSH=0 numactl --localalloc -C56 $1
}