Arquivos
rocm-systems/src/Makefile
T

91 linhas
2.5 KiB
Makefile
Original Visão Normal Histórico

2017-08-08 16:18:34 -07:00
#
# Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
2017-08-08 16:18:34 -07:00
#
# See LICENSE.txt for license information
2017-08-08 16:18:34 -07:00
#
CUDA_HOME ?= /usr/local/cuda
PREFIX ?= /usr/local
VERBOSE ?= 0
DEBUG ?= 0
CUDA_LIB ?= $(CUDA_HOME)/lib64
CUDA_INC ?= $(CUDA_HOME)/include
NVCC = $(CUDA_HOME)/bin/nvcc
2020-06-23 18:16:46 -07:00
CUDA_VERSION = $(strip $(shell which $(NVCC) >/dev/null && $(NVCC) --version | grep release | sed 's/.*release //' | sed 's/\,.*//'))
CUDA_MAJOR = $(shell echo $(CUDA_VERSION) | cut -d "." -f 1)
2017-08-08 16:18:34 -07:00
# Better define NVCC_GENCODE in your environment to the minimal set
# of archs to reduce compile time.
2020-06-23 18:16:46 -07:00
ifeq ($(shell test "0$(CUDA_MAJOR)" -ge 11; echo $$?),0)
NVCC_GENCODE ?= -gencode=arch=compute_60,code=sm_60 \
-gencode=arch=compute_61,code=sm_61 \
-genncode=arch=compute_70,code=sm_70 \
-gencode=arch=compute_80,code=sm_80 \
-gencode=arch=compute_80,code=compute_80
else
2020-06-15 08:54:21 -07:00
NVCC_GENCODE ?= -gencode=arch=compute_35,code=sm_35 \
2017-08-08 16:18:34 -07:00
-gencode=arch=compute_50,code=sm_50 \
2020-06-23 18:16:46 -07:00
-gencode=arch=compute_60,code=sm_60 \
2017-08-08 16:18:34 -07:00
-gencode=arch=compute_61,code=sm_61 \
2020-06-23 18:16:46 -07:00
-gencode=arch=compute_70,code=sm_70 \
-gencode=arch=compute_70,code=compute_70
endif
2017-08-08 16:18:34 -07:00
NVCUFLAGS := -ccbin $(CXX) $(NVCC_GENCODE) -std=c++11
LDFLAGS := -L${CUDA_LIB} -lcudart -lrt
NVLDFLAGS := -L${CUDA_LIB} -lcudart -lrt
ifeq ($(DEBUG), 0)
NVCUFLAGS += -O3 -g
CXXFLAGS += -O3 -g
2017-08-08 16:18:34 -07:00
else
NVCUFLAGS += -O0 -G -g
CXXFLAGS += -O0 -g -ggdb3
endif
ifneq ($(VERBOSE), 0)
NVCUFLAGS += -Xcompiler -Wall,-Wextra,-Wno-unused-parameter
else
2017-08-08 16:18:34 -07:00
.SILENT:
endif
.PHONY: build clean
BUILDDIR ?= ../build
2017-08-09 10:41:31 -07:00
ifneq ($(NCCL_HOME), "")
NVCUFLAGS += -I$(NCCL_HOME)/include/
NVLDFLAGS += -L$(NCCL_HOME)/lib
2017-08-08 16:18:34 -07:00
endif
ifeq ($(MPI), 1)
NVCUFLAGS += -DMPI_SUPPORT -I$(MPI_HOME)/include
2019-12-16 16:18:22 -08:00
NVLDFLAGS += -L$(MPI_HOME)/lib -L$(MPI_HOME)/lib64 -lmpi
2017-08-08 16:18:34 -07:00
endif
LIBRARIES += curand nccl nvToolsExt
NVLDFLAGS += $(LIBRARIES:%=-l%)
2017-08-08 16:18:34 -07:00
DST_DIR := $(BUILDDIR)
SRC_FILES := $(wildcard *.cu)
OBJ_FILES := $(SRC_FILES:%.cu=${DST_DIR}/%.o)
2020-03-17 12:00:19 -07:00
BIN_FILES_LIST := all_reduce all_gather broadcast reduce_scatter reduce alltoall
2017-08-08 16:18:34 -07:00
BIN_FILES := $(BIN_FILES_LIST:%=${DST_DIR}/%_perf)
build: ${BIN_FILES}
clean:
rm -rf ${DST_DIR}
${DST_DIR}/%.o: %.cu common.h
2017-08-08 16:18:34 -07:00
@printf "Compiling %-35s > %s\n" $< $@
@mkdir -p ${DST_DIR}
$(NVCC) -o $@ $(NVCUFLAGS) -c $<
${DST_DIR}/%_perf:${DST_DIR}/%.o ${DST_DIR}/common.o
@printf "Linking %-35s > %s\n" $< $@
@mkdir -p ${DST_DIR}
$(NVCC) -o $@ $(NVCUFLAGS) $^ ${NVLDFLAGS}