Also don't add br2_local by default, default params are insane.
This commit is contained in:
Ciro Santilli
2018-03-14 12:25:51 +00:00
parent 4a62be3eb3
commit 039b8a498c
6 changed files with 63 additions and 7 deletions

View File

@@ -8,8 +8,12 @@ KERNEL_MODULE_VERSION = 1.0
KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_PATH)
KERNEL_MODULE_SITE_METHOD = local
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
KERNEL_MODULE_DEPENDENCIES += openblas
endif
define KERNEL_MODULE_BUILD_CMDS
$(MAKE) -C '$(@D)/user' CC="$(TARGET_CC)" LD="$(TARGET_LD)"
$(MAKE) -C '$(@D)/user' BR2_PACKAGE_OPENBLAS="$(BR2_PACKAGE_OPENBLAS)" CC="$(TARGET_CC)" LD="$(TARGET_LD)"
endef
define KERNEL_MODULE_INSTALL_TARGET_CMDS

View File

@@ -2,14 +2,20 @@
CFLAGS_EXTRA ?= -ggdb3 -fopenmp -O0 -std=c99 -Wall -Werror -Wextra
IN_EXT ?= .c
LIBS :=
OUT_EXT ?= .out
OUTS := $(addsuffix $(OUT_EXT), $(basename $(wildcard *$(IN_EXT))))
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
LIBS += -lopenblas
else
OUTS := $(filter-out openblas.out,$(OUTS))
endif
all: $(OUTS)
%$(OUT_EXT): %$(IN_EXT)
$(CC) $(CFLAGS) $(CFLAGS_EXTRA) -o '$@' '$<'
$(CC) $(CFLAGS) $(CFLAGS_EXTRA) -o '$@' '$<' $(LIBS)
clean:
rm -f *'$(OUT_EXT)'

View File

@@ -0,0 +1,18 @@
/*
OpenBLAS hello world, initially adapted from:
https://stackoverflow.com/questions/49227682/gem5-can-not-simulate-my-program-that-calls-openblas-functions-with-an-fatal-err
*/
#include <cblas.h>
#include <stdio.h>
int main() {
size_t i = 0;
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(i = 0; i < 9; i++)
printf("%f ", C[i]);
printf("\n");
}