From 8b6d75e57e0d033c7fed339bfe0fd6a5cf627aa3 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Mon, 20 Nov 2017 19:24:44 +1100 Subject: [PATCH] openblas: update 0.2.15 --> 2.2.20 and build optimised lapack Openblas has it's own optimised versions of netlib lapack that it bundles into `-lopenblas` so won't conflict with those libs. Also enable RecursiveLAPACK. From `Makefile.rule`: ``` Force number of make jobs. The default is the number of logical CPU of the host. This is particularly useful when using distcc. A negative value will disable adding a -j flag to make, allowing to use a parent make -j value. This is useful to call OpenBLAS make from an other project makefile MAKE_NB_JOBS = 2 ``` fixes #1651 --- src/openblas-1-fixes.patch | 23 ++++++++++++ src/openblas-test.c | 71 ++++++++++++++++++++++++++++++++++++++ src/openblas.mk | 32 ++++++++--------- 3 files changed, 109 insertions(+), 17 deletions(-) create mode 100644 src/openblas-1-fixes.patch create mode 100644 src/openblas-test.c diff --git a/src/openblas-1-fixes.patch b/src/openblas-1-fixes.patch new file mode 100644 index 00000000..ca0ee2c2 --- /dev/null +++ b/src/openblas-1-fixes.patch @@ -0,0 +1,23 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tony Theodore +Date: Mon, 20 Nov 2017 16:20:03 +1100 +Subject: [PATCH 1/1] ARCH from openblas build conflicts with lapack + + +diff --git a/Makefile b/Makefile +index 1111111..2222222 100644 +--- a/Makefile ++++ b/Makefile +@@ -241,7 +241,7 @@ ifndef NOFORTRAN + -@echo "LOADOPTS = $(FFLAGS) $(EXTRALIB)" >> $(NETLIB_LAPACK_DIR)/make.inc + -@echo "CC = $(CC)" >> $(NETLIB_LAPACK_DIR)/make.inc + -@echo "override CFLAGS = $(LAPACK_CFLAGS)" >> $(NETLIB_LAPACK_DIR)/make.inc +- -@echo "ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc ++ -@echo "override ARCH = $(AR)" >> $(NETLIB_LAPACK_DIR)/make.inc + -@echo "ARCHFLAGS = -ru" >> $(NETLIB_LAPACK_DIR)/make.inc + -@echo "RANLIB = $(RANLIB)" >> $(NETLIB_LAPACK_DIR)/make.inc + -@echo "LAPACKLIB = ../$(LIBNAME)" >> $(NETLIB_LAPACK_DIR)/make.inc diff --git a/src/openblas-test.c b/src/openblas-test.c new file mode 100644 index 00000000..1568224c --- /dev/null +++ b/src/openblas-test.c @@ -0,0 +1,71 @@ +/* + * This file is part of MXE. + * See index.html for further information. + * + * taken from: https://gist.github.com/xianyi/5780018 + */ + +#include "stdio.h" +#include "stdlib.h" +#include "sys/time.h" +#include "time.h" + +extern void dgemm_(char*, char*, int*, int*,int*, double*, double*, int*, double*, int*, double*, double*, int*); + +int main(int argc, char* argv[]) +{ + int i; + printf("test!\n"); + if(argc<4){ + printf("Input Error\n"); + return 1; + } + + int m = atoi(argv[1]); + int n = atoi(argv[2]); + int k = atoi(argv[3]); + int sizeofa = m * k; + int sizeofb = k * n; + int sizeofc = m * n; + char ta = 'N'; + char tb = 'N'; + double alpha = 1.2; + double beta = 0.001; + + struct timeval start,finish; + double duration; + + double* A = (double*)malloc(sizeof(double) * sizeofa); + double* B = (double*)malloc(sizeof(double) * sizeofb); + double* C = (double*)malloc(sizeof(double) * sizeofc); + + srand((unsigned)time(NULL)); + + for (i=0; i