Bläddra i källkod

Enable openblas

master
Christos Choutouridis 1 vecka sedan
förälder
incheckning
51d7e6dd88
2 ändrade filer med 27 tillägg och 8 borttagningar
  1. +17
    -7
      homework_1/Makefile
  2. +10
    -1
      homework_1/src/main.cpp

+ 17
- 7
homework_1/Makefile Visa fil

@@ -25,7 +25,8 @@ TARGET := knnsearch
# Source directories list(space seperated). Makefile-relative path, UNDER current directory.
SRC_DIR_LIST := src
# 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.
# EXC_FILE_LIST := bad.cpp old.cpp

@@ -48,7 +49,7 @@ PRE_DEFS :=

# ============== Linker settings ==============
# Linker flags (example: -pthread -lm)
LDFLAGS := -pthread
LDFLAGS := -pthread -lopenblas
# Map output file
MAP_FILE := output.map
MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE)
@@ -57,7 +58,7 @@ MAP_FLAG := -Xlinker -Map=$(BUILD_DIR)/$(MAP_FILE)
# We need:
# - 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).
DOCKER_VOL_DIR := $${PWD}
DOCKER_VOL_DIR := ${PWD}
DOCKER_WRK_DIR :=
DOCKER_RUN := docker run --rm
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)
@mkdir -p $(@D)
@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 Print size information
@$(CSIZE) $(@D)/$(TARGET)
@@ -221,7 +222,6 @@ v1: $(BUILD_DIR)/$(TARGET)
cp $(BUILD_DIR)/$(TARGET) out/$(TARGET)



#
# ========= Inside CSAL Image build rules ===========
#
@@ -258,4 +258,14 @@ csal_v1: TARGET := knnsearch_v1
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)

+ 10
- 1
homework_1/src/main.cpp Visa fil

@@ -1,6 +1,15 @@
#include <iostream>
#include <cblas.h>

int main(){
std::cout << "Hello from knnsearch\n";

double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5};
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);

for (int i=0 ; i<9 ; ++i)
std::cout << C[i] << ' ';
std::cout << '\n';
return 0;
}

Laddar…
Avbryt
Spara