-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup_cosim_build_env.sh
73 lines (63 loc) · 2.67 KB
/
setup_cosim_build_env.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# setup brg sdh pytorch building env
echo " Setting up PyTorch building environment ... "
echo " Make sure you enabled devtoolset-8!"
echo " Make sure correct Python environemnt is set!"
echo ""
# setup path to MKL
export MKL_ROOT=/work/global/lc873/work/sdh/venv_baseline/
export MKL_INCLUDE=$MKL_ROOT/include
export MKL_LIBRARY=$MKL_ROOT/lib
export CMAKE_INCLUDE_PATH=$MKL_INCLUDE:$CMAKE_INCLUDE_PATH
export CMAKE_LIBRARY_PATH=$MKL_LIBRARY:$CMAKE_LIBRARY_PATH
# setup pytorch building options
export REL_WITH_DEB_INFO=1
export BUILD_TEST=0
export USE_MKL=1
export USE_MKLDNN=0
export USE_CUDA=0
export USE_CUDNN=0
export USE_FBGEMM=0
export USE_NNPACK=0
export USE_QNNPACK=0
export USE_DISTRIBUTED=0
export OMP_NUM_THREADS=1
# Use gold if it's available for faster linking.
if which gold >/dev/null 2>&1 ; then
export CFLAGS='-fuse-ld=gold'
fi
# get current directory
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
echo " hb-pytorch lives in $DIR"
# setup cudalite runtime and pytorch kernel binary paths
if [ -z "$BRG_BSG_BLADERUNNER_DIR" ]
then
export BSG_MANYCORE_INCLUDE="<path-to-your-cudalite-cosim-runtime-source>"
export BSG_MANYCORE_LDPATH="<path-to-your-cudalite-cosim-runtime-lib>"
else
export BSG_MANYCORE_INCLUDE=$BRG_BSG_BLADERUNNER_DIR/bsg_replicant/libraries
export BSG_MANYCORE_LDPATH=$BRG_BSG_BLADERUNNER_DIR/bsg_replicant/libraries/platforms/bigblade-vcs
fi
export USE_HB_COSIM=1
# Build COSIM runtime library and simulation executable if not using one of the
# BRG servers -- on BRG servers we have global installed COSIM so SW side ppl
# dont have to worry about COSIM installation
if [[ "x${SETUP_BRG_HAMMERBLADE}" != "xyes" ]]; then
export BSG_MACHINE=pod_X1Y1_ruche_X16Y8_hbm
export BSG_MACHINE_PATH=$BRG_BSG_BLADERUNNER_DIR/bsg_replicant/machines/$BSG_MACHINE
make -C $BRG_BSG_BLADERUNNER_DIR/bsg_replicant/examples/python/test_loader main.exec
make -C $BRG_BSG_BLADERUNNER_DIR/bsg_replicant/examples/python/test_loader main.profile
make -C $BRG_BSG_BLADERUNNER_DIR/bsg_replicant/examples/python/test_loader main.saif
fi
export HB_KERNEL_DIR=$DIR/hammerblade/torch
echo " \$BSG_MANYCORE_INCLUDE is set to $BSG_MANYCORE_INCLUDE"
echo " \$BSG_MANYCORE_LDPATH is set to $BSG_MANYCORE_LDPATH"
echo " \$HB_KERNEL_DIR is set to $HB_KERNEL_DIR"
echo ""
echo " Done!"
echo ""