-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (40 loc) · 1.36 KB
/
Makefile
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
SHELL := /bin/bash
EXPECTED_ENV=stdpar-bh
D ?= 2
DIM_SIZE=$D
OUTFILE=./nbody_d${DIM_SIZE}
MAIN=./src/main.cpp
CONDA_FILES=-I${CONDA_PREFIX}/include -L${CONDA_PREFIX}/lib
STDEXEC=./stdexec/include
VERSION=-std=c++20
# nvidia flags
FLAGS=${VERSION} -fast -DDIM_SIZE=${DIM_SIZE}
GPU_DEBUG=-gpu=lineinfo -gpu=keep
GPU_FLAGS=-stdpar=gpu
# other flags
CXX_FLAGS=${VERSION} -march=native -Ofast -ltbb -lpthread -DDIM_SIZE=${DIM_SIZE}
PEDANTIC=-Wall -Wextra -pedantic
# GET_TBB=source ~/intel/oneapi/setvars.sh
gcc: check-env
g++ ${CXX_FLAGS} ${CONDA_FILES} ${MAIN} -o ${OUTFILE}_${@}
clang: check-env
clang++ ${CXX_FLAGS} ${CONDA_FILES} ${MAIN} -o ${OUTFILE}_${@}
# icpx: intel
# ${GET_TBB} && icpx ${CXX_FLAGS} ${CONDA_FILES} ${MAIN} -o ${OUTFILE}_${@}
nvcpp: check-env
nvc++ ${FLAGS} -stdpar=multicore ${CONDA_FILES} ${MAIN} -o ${OUTFILE}_${@}
gpu: check-env
nvc++ ${FLAGS} ${GPU_FLAGS} ${CONDA_FILES} ${MAIN} -o ${OUTFILE}_gpu
debug: check-env
g++ ${VERSION} -DDIM_SIZE=${DIM_SIZE} -g -O0 -ltbb ${MAIN} -o ${OUTFILE}_${@}
cpu: gcc clang nvcpp
default: gcc
all: default
nothing:
check-env:
@if [ "${CONDA_DEFAULT_ENV}" != "${EXPECTED_ENV}" ]; then \
echo "Error: Incorrect mamba environment. Expected ${EXPECTED_ENV}, got ${CONDA_DEFAULT_ENV}. Please run: mamba activate ${EXPECTED_ENV}"; \
exit 1; \
fi
clean:
rm -f pgcuda* .main* main.n* nbody* report*