|
@@ -25,7 +25,8 @@ TARGET := knnsearch |
|
|
# Source directories list(space seperated). Makefile-relative path, UNDER current directory. |
|
|
# Source directories list(space seperated). Makefile-relative path, UNDER current directory. |
|
|
SRC_DIR_LIST := src |
|
|
SRC_DIR_LIST := src |
|
|
# Include directories list(space seperated). Makefile-relative path. |
|
|
# Include directories list(space seperated). Makefile-relative path. |
|
|
INC_DIR_LIST := src inc |
|
|
|
|
|
|
|
|
INC_DIR_LIST := inc \ |
|
|
|
|
|
src |
|
|
# Exclude files list(space seperated). Filenames only. |
|
|
# Exclude files list(space seperated). Filenames only. |
|
|
# EXC_FILE_LIST := bad.cpp old.cpp |
|
|
# EXC_FILE_LIST := bad.cpp old.cpp |
|
|
|
|
|
|
|
@@ -48,7 +49,7 @@ PRE_DEFS := |
|
|
|
|
|
|
|
|
# ============== Linker settings ============== |
|
|
# ============== Linker settings ============== |
|
|
# Linker flags (example: -pthread -lm) |
|
|
# Linker flags (example: -pthread -lm) |
|
|
LDFLAGS := -pthread |
|
|
|
|
|
|
|
|
LDFLAGS := -pthread -lopenblas |
|
|
# Map output file |
|
|
# Map output file |
|
|
MAP_FILE := output.map |
|
|
MAP_FILE := output.map |
|
|
MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE) |
|
|
MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE) |
|
@@ -57,7 +58,7 @@ MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE) |
|
|
# We need: |
|
|
# We need: |
|
|
# - Bind the entire project directory(the dir that icludes all the code) as volume. |
|
|
# - Bind the entire project directory(the dir that icludes all the code) as volume. |
|
|
# - In docker instance, change to working directory(where the makefile is). |
|
|
# - In docker instance, change to working directory(where the makefile is). |
|
|
DOCKER_VOL_DIR := $${PWD} |
|
|
|
|
|
|
|
|
DOCKER_VOL_DIR := ${PWD} |
|
|
DOCKER_WRK_DIR := |
|
|
DOCKER_WRK_DIR := |
|
|
DOCKER_RUN := docker run --rm |
|
|
DOCKER_RUN := docker run --rm |
|
|
DOCKER_FLAGS := -v $(DOCKER_VOL_DIR):/usr/src/$(PROJECT) -w /usr/src/$(PROJECT)/$(DOCKER_WRK_DIR) |
|
|
DOCKER_FLAGS := -v $(DOCKER_VOL_DIR):/usr/src/$(PROJECT) -w /usr/src/$(PROJECT)/$(DOCKER_WRK_DIR) |
|
@@ -137,8 +138,8 @@ include $(wildcard $(DEP)) |
|
|
$(BUILD_DIR)/$(TARGET): $(OBJ) |
|
|
$(BUILD_DIR)/$(TARGET): $(OBJ) |
|
|
@mkdir -p $(@D) |
|
|
@mkdir -p $(@D) |
|
|
@echo Linking to target: $(TARGET) |
|
|
@echo Linking to target: $(TARGET) |
|
|
@echo $(DOCKER) $(CXX) $(LDFLAGS) $(MAP_FLAG) -o $(@D)/$(TARGET) '$$(OBJ)' |
|
|
|
|
|
@$(DOCKER) $(CXX) $(LDFLAGS) $(MAP_FLAG) -o $(@D)/$(TARGET) $(OBJ) |
|
|
|
|
|
|
|
|
@echo $(DOCKER) $(CXX) '$$(OBJ)' $(LDFLAGS) $(MAP_FLAG) -o $(@D)/$(TARGET) |
|
|
|
|
|
@$(DOCKER) $(CXX) $(OBJ) $(LDFLAGS) $(MAP_FLAG) -o $(@D)/$(TARGET) |
|
|
@echo |
|
|
@echo |
|
|
@echo Print size information |
|
|
@echo Print size information |
|
|
@$(CSIZE) $(@D)/$(TARGET) |
|
|
@$(CSIZE) $(@D)/$(TARGET) |
|
@@ -221,7 +222,6 @@ v1: $(BUILD_DIR)/$(TARGET) |
|
|
cp $(BUILD_DIR)/$(TARGET) out/$(TARGET) |
|
|
cp $(BUILD_DIR)/$(TARGET) out/$(TARGET) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
# |
|
|
# ========= Inside CSAL Image build rules =========== |
|
|
# ========= Inside CSAL Image build rules =========== |
|
|
# |
|
|
# |
|
@@ -258,4 +258,14 @@ csal_v1: TARGET := knnsearch_v1 |
|
|
csal_v1: $(BUILD_DIR)/$(TARGET) |
|
|
csal_v1: $(BUILD_DIR)/$(TARGET) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
|
# ======== Run from container ========= |
|
|
|
|
|
# |
|
|
|
|
|
# examples: |
|
|
|
|
|
# |
|
|
|
|
|
# make IMAGE=hpcimage EXEC=knnsearch_v1 run |
|
|
|
|
|
# make IMAGE=hpcimage EXEC=knnsearch_cilkv1 run |
|
|
|
|
|
# |
|
|
|
|
|
run: DOCKER := $(DOCKER_CMD) |
|
|
|
|
|
run: |
|
|
|
|
|
$(DOCKER) ./out/$(EXEC) |