mirror of https://git.wownero.com/dsc/mxe.git
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
This commit is contained in:
parent
e48e157c9e
commit
8b6d75e57e
|
@ -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 <tonyt@logyst.com>
|
||||||
|
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
|
|
@ -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<sizeofa; i++)
|
||||||
|
A[i] = i%3+1;//(rand()%100)/10.0;
|
||||||
|
|
||||||
|
for (i=0; i<sizeofb; i++)
|
||||||
|
B[i] = i%3+1;//(rand()%100)/10.0;
|
||||||
|
|
||||||
|
for (i=0; i<sizeofc; i++)
|
||||||
|
C[i] = i%3+1;//(rand()%100)/10.0;
|
||||||
|
//#if 0
|
||||||
|
printf("m=%d,n=%d,k=%d,alpha=%lf,beta=%lf,sizeofc=%d\n",m,n,k,alpha,beta,sizeofc);
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
dgemm_(&ta, &tb, &m, &n, &k, &alpha, A, &m, B, &k, &beta, C, &m);
|
||||||
|
gettimeofday(&finish, NULL);
|
||||||
|
|
||||||
|
duration = ((double)(finish.tv_sec-start.tv_sec)*1000000 + (double)(finish.tv_usec-start.tv_usec)) / 1000000;
|
||||||
|
double gflops = 2.0 * m *n*k;
|
||||||
|
gflops = gflops/duration*1.0e-6;
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
|
fp = fopen("timeDGEMM.txt", "a");
|
||||||
|
fprintf(fp, "%dx%dx%d\t%lf s\t%lf MFLOPS\n", m, n, k, duration, gflops);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
free(A);
|
||||||
|
free(B);
|
||||||
|
free(C);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -4,20 +4,13 @@ PKG := openblas
|
||||||
$(PKG)_WEBSITE := http://www.openblas.net/
|
$(PKG)_WEBSITE := http://www.openblas.net/
|
||||||
$(PKG)_DESCR := OpenBLAS
|
$(PKG)_DESCR := OpenBLAS
|
||||||
$(PKG)_IGNORE :=
|
$(PKG)_IGNORE :=
|
||||||
$(PKG)_VERSION := 0.2.15
|
$(PKG)_VERSION := 0.2.20
|
||||||
$(PKG)_CHECKSUM := 73c40ace5978282224e5e122a41c8388c5a19e65a6f2329c2b7c0b61bacc9044
|
$(PKG)_CHECKSUM := 5ef38b15d9c652985774869efd548b8e3e972e1e99475c673b25537ed7bcf394
|
||||||
$(PKG)_SUBDIR := OpenBLAS-$($(PKG)_VERSION)
|
$(PKG)_GH_CONF := xianyi/OpenBLAS/tags, v
|
||||||
$(PKG)_FILE := $($(PKG)_SUBDIR).tar.gz
|
|
||||||
$(PKG)_URL := https://github.com/xianyi/OpenBLAS/archive/v$($(PKG)_VERSION).tar.gz
|
|
||||||
$(PKG)_DEPS := gcc pthreads
|
$(PKG)_DEPS := gcc pthreads
|
||||||
|
|
||||||
define $(PKG)_UPDATE
|
# openblas has it's own optimised versions of netlib lapack that
|
||||||
$(WGET) -q -O- 'https://github.com/xianyi/OpenBLAS/releases' | \
|
# it bundles into -lopenblas so won't conflict with those libs
|
||||||
$(SED) -n 's,.*OpenBLAS/archive/v\([0-9][^"]*\)\.tar\.gz.*,\1,p' | \
|
|
||||||
grep -v 'rc' | \
|
|
||||||
$(SORT) -V | \
|
|
||||||
tail -1
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(PKG)_MAKE_OPTS = \
|
$(PKG)_MAKE_OPTS = \
|
||||||
PREFIX='$(PREFIX)/$(TARGET)' \
|
PREFIX='$(PREFIX)/$(TARGET)' \
|
||||||
|
@ -25,9 +18,9 @@ $(PKG)_MAKE_OPTS = \
|
||||||
FC='$(TARGET)-gfortran' \
|
FC='$(TARGET)-gfortran' \
|
||||||
CC='$(TARGET)-gcc' \
|
CC='$(TARGET)-gcc' \
|
||||||
HOSTCC='$(BUILD_CC)' \
|
HOSTCC='$(BUILD_CC)' \
|
||||||
|
MAKE_NB_JOBS=-1 \
|
||||||
CROSS=1 \
|
CROSS=1 \
|
||||||
NO_CBLAS=1 \
|
BUILD_RELAPACK=1 \
|
||||||
NO_LAPACK=1 \
|
|
||||||
USE_THREAD=1 \
|
USE_THREAD=1 \
|
||||||
USE_OPENMP=1 \
|
USE_OPENMP=1 \
|
||||||
TARGET=CORE2 \
|
TARGET=CORE2 \
|
||||||
|
@ -38,9 +31,14 @@ $(PKG)_MAKE_OPTS = \
|
||||||
BINARY=$(BITS) \
|
BINARY=$(BITS) \
|
||||||
$(if $(BUILD_STATIC),NO_SHARED=1) \
|
$(if $(BUILD_STATIC),NO_SHARED=1) \
|
||||||
$(if $(BUILD_SHARED),NO_STATIC=1) \
|
$(if $(BUILD_SHARED),NO_STATIC=1) \
|
||||||
EXTRALIB="`'$(TARGET)-pkg-config' --libs pthreads` -fopenmp"
|
EXTRALIB="`'$(TARGET)-pkg-config' --libs pthreads` -fopenmp -lgfortran -lquadmath"
|
||||||
|
|
||||||
define $(PKG)_BUILD
|
define $(PKG)_BUILD
|
||||||
$(MAKE) -C '$(1)' -j '$(JOBS)' $($(PKG)_MAKE_OPTS)
|
$(MAKE) -C '$(SOURCE_DIR)' -j '$(JOBS)' $($(PKG)_MAKE_OPTS)
|
||||||
$(MAKE) -C '$(1)' -j 1 install $($(PKG)_MAKE_OPTS)
|
$(MAKE) -C '$(SOURCE_DIR)' -j 1 install $($(PKG)_MAKE_OPTS)
|
||||||
|
|
||||||
|
'$(TARGET)-gcc' \
|
||||||
|
-W -Wall -Werror \
|
||||||
|
'$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
|
||||||
|
`'$(TARGET)-pkg-config' --cflags --libs $(PKG)`
|
||||||
endef
|
endef
|
||||||
|
|
Loading…
Reference in New Issue