forked from acts-project/traccc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvc++_p
executable file
·107 lines (88 loc) · 3.07 KB
/
nvc++_p
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
# Initialize path to compilers based on system default
NVCPP=$( which nvc++ )
CXX=$( which g++ )
# Parse arguments
args=$*
# Check parameter existences which determines if nvc++ is used as compiler
is_any_in_args(){
for arg in "$@"
do
# check if current argument is present in string of arguments
echo "$args" | grep -q "$arg"
if [[ $? -eq 0 ]]; then
return 0
fi
done
return 1
}
# declare files to be compiled with nvc++
NVCPP_DIRS=(
"traccc_stdpar_seq_example.dir"
"traccc_stdpar_par_example.dir"
"traccc_stdpar_par_unseq_example.dir"
"traccc_stdpar.dir"
"traccc_test_stdpar_fastsv.dir"
"traccc_stdpar_fastsv_example"
"traccc_stdpar_sparseccl_example"
"traccc_test_stdpar_sparseccl.dir"
"traccc_benchmark_stdpar_cca.dir")
# Prepare compiler args for nvc++ or g++
if is_any_in_args "${NVCPP_DIRS[@]}"; then
echo ""; echo "******************************"
echo "Use NVC++ COMPILER"
echo "******************************"; echo ""
# Define the local configuration file that should be used by nvc++
## > makelocalrc -gcc PATH_TO_GCC -gpp PATH_TO_G++ -x -d PATH_TO_LOCALRC_DIR
PATH_TO_LOCALRC_DIR="/bld6/users/nwachuch/traccc"
LOCALRC=""
GCCVER=$( gcc --version | head -1 | awk '{print $NF}' )
case $GCCVER in
11.2.0)
LOCALRC="${PATH_TO_LOCALRC_DIR}/localrc_gcc112"
;;
10.2.0)
LOCALRC="${PATH_TO_LOCALRC_DIR}/localrc_gcc102"
;;
10.1.0)
LOCALRC="${PATH_TO_LOCALRC_DIR}/localrc_gcc101"
;;
9.3.0)
LOCALRC="${PATH_TO_LOCALRC_DIR}/localrc_gcc93"
;;
esac
if [[ ! -f $LOCALRC ]]; then
echo "nvc++_p ERROR: no local rc file \"$LOCALRC\" found"
exit 1
fi
LOCALRC="-rc=${LOCALRC}"
STDPAROPTS="-cudalib=curand"
# remove compiler flags not supported by nvc++
X=$( echo $args | sed s/-pipe// )
X=$( echo $X | sed s/-Wno-unused-local-typedefs// )
X=$( echo $X | sed s/-Wunused-local-typedefs// ) # TODO: newly added, verify if no side effects
X=$( echo $X | sed s/-Woverloaded-virtual// )
X=$( echo $X | sed s/-fdiagnostics-color=always// )
X=$( echo $X | sed s/gnu++17/c++17/ )
## needed for CMAKE_RELEASE_TYPE=Debug
X=$( echo $X | sed s/-fsanitize=undefined// )
X=$( echo $X | sed s/-g3// ) # TODO newly added
X=$( echo $X | sed s/-Werror// ) # TODO newly added: should only be temporary until dependencies have fixed the "no new line warnings"
## get an undefined cudaGetDevice
X=$( echo $X | perl -ne '@X=split(" ",$_); @Y=map(/libcudart_static.a/ ? () : $_, @X); print "@Y"' )
X=$( echo $X | sed s/-lcudart_static// )
CXX=${NVCPP}
CXXARGS="$LOCALRC $STDPAROPTS $X"
else
args=$( echo $args | perl -ne '@X=split(" ",$_); @Y=map(/libcudart_static.a/ ? () : $_, @X); print "@Y"' )
CXXARGS=$args
fi
## ubsan needed for Debug
if [[ $DBG -eq 1 ]]; then
DBGOPTS=" -lubsan"
fi
CXXARGS+=$DBGOPTS
if [[ ! -z ${NVCPP_VERBOSE+set} ]]; then
echo "==> $CXX $CXXARGS"
fi
$CXX $CXXARGS