Makefile 1.05 KB
Newer Older
Henning Fehrmann's avatar
Henning Fehrmann committed
1
2

GPU=AMD
Henning Fehrmann's avatar
Henning Fehrmann committed
3
GPU=NVIDIA
Henning Fehrmann's avatar
Henning Fehrmann committed
4

Henning Fehrmann's avatar
Henning Fehrmann committed
5
6
OBJ_blas = blas.o
OBJ_fftw = fftw.o
Henning Fehrmann's avatar
Henning Fehrmann committed
7
OBJ_tensor_core = tensor_core.o
Henning Fehrmann's avatar
Henning Fehrmann committed
8
9
10


ifeq ($(GPU), AMD)
Henning Fehrmann's avatar
Henning Fehrmann committed
11
12
13
  LDFLAGS = -L/opt/rocm/lib -fopenmp
  LDFLAGS_blas = -lhipblas -lrocblas
  LDFLAGS_fftw = -lrocfft
Henning Fehrmann's avatar
Henning Fehrmann committed
14
15
16
17
  CFLAGS = -g -Wall -O3 -fopenmp -I/opt/rocm/include -I/opt/rocm/hip/include -DROC
  CC = hipcc
else ifeq ($(GPU), NVIDIA)
  CC = nvcc
Henning Fehrmann's avatar
Henning Fehrmann committed
18
19
  LDFLAGS = -lm -lgomp
  LDFLAGS_blas =  -lcublas
Henning Fehrmann's avatar
Henning Fehrmann committed
20
  LDFLAGS_fftw =  -lcufft
Henning Fehrmann's avatar
Henning Fehrmann committed
21
  INCLUDE= -I/usr/lib/x86_64-linux-gnu/openmpi/include/
Henning Fehrmann's avatar
Henning Fehrmann committed
22
23
  CFLAGS = ${INCLUDE}  -arch sm_70 --compile -O3 -pg -Xcompiler -fopenmp -DCUDA
  CUDAFLAGS = -arch sm_70  --Werror cross-execution-space-call --Wno-deprecated-gpu-targets
Henning Fehrmann's avatar
Henning Fehrmann committed
24
25
26
27
else
  unknown_HW:
endif

Henning Fehrmann's avatar
Henning Fehrmann committed
28
all: blas fftw
Henning Fehrmann's avatar
Henning Fehrmann committed
29

Henning Fehrmann's avatar
Henning Fehrmann committed
30
31
32
blas: ${OBJ_blas}
	${CC} -o blas ${OBJ_blas} ${LDFLAGS} ${LDFLAGS_blas} ${CUDAFLAGS}

Henning Fehrmann's avatar
Henning Fehrmann committed
33
34
35
tensor_core: ${OBJ_tensor_core}
	${CC} -o tensor_core ${OBJ_tensor_core} ${LDFLAGS} ${LDFLAGS_blas} ${CUDAFLAGS}

Henning Fehrmann's avatar
Henning Fehrmann committed
36
37
fftw: ${OBJ_fftw}
	${CC} -o fftw ${OBJ_fftw} ${LDFLAGS} ${LDFLAGS_fftw} ${CUDAFLAGS}
Henning Fehrmann's avatar
Henning Fehrmann committed
38
39
40
41
42
43
44
45
46

%.o: %.c ${HEADER}
	${CC} ${CFLAGS} -c $<

clean:
	rm *.o

unknown_HW:
	@echo "hardware not detected"