Makefile 1.89 KB
Newer Older
1
#
gilbertlee-amd's avatar
gilbertlee-amd committed
2
# Copyright (c) 2019-2025 Advanced Micro Devices, Inc. All rights reserved.
3
#
Gilbert Lee's avatar
Gilbert Lee committed
4

5
6
7
8
9
10
11
12
13
# Configuration options
ROCM_PATH ?= /opt/rocm
CUDA_PATH ?= /usr/local/cuda

HIPCC=$(ROCM_PATH)/bin/hipcc
NVCC=$(CUDA_PATH)/bin/nvcc

# Compile TransferBenchCuda if nvcc detected
ifeq ("$(shell test -e $(NVCC) && echo found)", "found")
gilbertlee-amd's avatar
gilbertlee-amd committed
14
  EXE=TransferBenchCuda
gilbertlee-amd's avatar
gilbertlee-amd committed
15
  CXX=$(NVCC)
16
else
gilbertlee-amd's avatar
gilbertlee-amd committed
17
  EXE=TransferBench
gilbertlee-amd's avatar
gilbertlee-amd committed
18
  CXX=$(HIPCC)
19
20
21
22
endif

CXXFLAGS = -I$(ROCM_PATH)/include -lnuma -L$(ROCM_PATH)/lib -lhsa-runtime64
NVFLAGS  = -x cu -lnuma -arch=native
23
COMMON_FLAGS = -O3 -I./src/header -I./src/client -I./src/client/Presets
24
25
LDFLAGS += -lpthread

gilbertlee-amd's avatar
gilbertlee-amd committed
26
27
28
29
# Compile RDMA executor if
# 1) DISABLE_NIC_EXEC is not set to 1
# 2) IBVerbs is found in the Dynamic Linker cache
# 3) infiniband/verbs.h is found in the default include path
gilbertlee-amd's avatar
gilbertlee-amd committed
30
31
NIC_ENABLED = 0
ifneq ($(DISABLE_NIC_EXEC),1)
gilbertlee-amd's avatar
gilbertlee-amd committed
32
33
34
35
36
  ifeq ("$(shell ldconfig -p | grep -c ibverbs)", "0")
    $(info lib IBVerbs not found)
  else ifeq ("$(shell echo '#include <infiniband/verbs.h>' | $(CXX) -E - 2>/dev/null | grep -c 'infiniband/verbs.h')", "0")
    $(info infiniband/verbs.h not found)
  else
gilbertlee-amd's avatar
gilbertlee-amd committed
37
38
39
40
    LDFLAGS += -libverbs -DNIC_EXEC_ENABLED
    NVFLAGS += -libverbs -DNIC_EXEC_ENABLED
    NIC_ENABLED = 1
  endif
gilbertlee-amd's avatar
gilbertlee-amd committed
41
42
43
  ifeq ($(NIC_ENABLED), 0)
    $(info To use the TransferBench RDMA executor, check if your system has NICs, the NIC drivers are installed, and libibverbs-dev is installed)
  endif
gilbertlee-amd's avatar
gilbertlee-amd committed
44
45
endif

46
47
all: $(EXE)

gilbertlee-amd's avatar
gilbertlee-amd committed
48
TransferBench: ./src/client/Client.cpp $(shell find -regex ".*\.\hpp") NicStatus
49
50
	$(HIPCC) $(CXXFLAGS) $(COMMON_FLAGS) $< -o $@ $(LDFLAGS)

gilbertlee-amd's avatar
gilbertlee-amd committed
51
TransferBenchCuda: ./src/client/Client.cpp $(shell find -regex ".*\.\hpp") NicStatus
52
	$(NVCC) $(NVFLAGS) $(COMMON_FLAGS) $< -o $@ $(LDFLAGS)
Gilbert Lee's avatar
Gilbert Lee committed
53
54

clean:
55
	rm -f *.o ./TransferBench ./TransferBenchCuda
gilbertlee-amd's avatar
gilbertlee-amd committed
56
57
58
59
60
61
62

NicStatus:
  ifeq ($(NIC_ENABLED), 1)
		$(info Building with NIC executor support. Can set DISABLE_NIC_EXEC=1 to disable)
  else
		$(info Building without NIC executor support)
  endif