ifndef ASCEND_HOME_PATH
$(error "ASCEND_HOME_PATH is not set, please ensure CANN is properly installed and \
source environment variables by running `source /path/to/Ascend/cann/set_env.sh`")
endif
CXXFLAGS := -std=c++17 \
-Werror \
-fstack-protector-strong \
-fPIE -pie \
-O2 \
-s \
-Wl,-z,relro \
-Wl,-z,now \
-Wl,-z,noexecstack \
-Wl,--copy-dt-needed-entries
SOURCES = main.cc
ASCEND_INC_DIR = ${ASCEND_HOME_PATH}/include
ASCEND_LIB_DIR = ${ASCEND_HOME_PATH}/lib64
LIBS = -L$(ASCEND_LIB_DIR) -lhccl -lascendcl
INCS = -I$(ASCEND_INC_DIR)
TARGET = one_device_per_pthread
all:
g++ $(CXXFLAGS) $(SOURCES) $(INCS) $(LIBS) -o ${TARGET}
@echo "${TARGET} compile completed"
test:
./$(TARGET)
clean:
rm ${TARGET}
help:
@echo ""
@echo "HCCL Example: One device per pthread"
@echo "===================================="
@echo ""
@echo "This example shows how to use HcclCommInitRootInfoConfig() to create"
@echo "communicators for multiple NPUs in a single process."
@echo ""
@echo "Targets:"
@echo " all - Build the example (default)"
@echo " test - Build and run test"
@echo " clean - Remove build artifacts"
@echo " help - Show this help"
@echo ""
.PHONY: all test clean help