[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
From: |
Mark H Weaver |
Subject: |
Re: [PATCH] Attempt to fix OpenBLAS on MIPS. |
Date: |
Wed, 22 Jul 2015 16:02:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Andreas Enge <address@hidden> writes:
> On Wed, Jul 22, 2015 at 05:59:06PM +0200, Ricardo Wurmus wrote:
>> The test target appears to only do something if TARGET is not set:
>> Since we do pass TARGET=SICORTEX the tests are skipped. I don’t know if
>> there’s a good reason for this.
>
> It looks a bit like a flawed logic to skip tests in cross building
> environments. Maybe it is worth asking upstream.
I removed this logic (see attached patch), and the tests passed except
for one:
--8<---------------cut here---------------start------------->8---
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./sblat3 < ./sblat3.dat
TESTS OF THE COMPLEX*16 LEVEL 2 BLAS
THE FOLLOWING PARAMETER VALUES WILL BE USED:
FOR N 0 1 2 3 7 31 63
FOR K 0 1 2 4
FOR INCX AND INCY 1 2 -1 -2
FOR ALPHA ( 0.0, 0.0) ( 1.0, 0.0) ( 0.7,-0.9)
FOR BETA ( 0.0, 0.0) ( 1.0, 0.0) ( 1.3,-1.1)
ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LESS THAN 16.00
RELATIVE MACHINE PRECISION IS TAKEN TO BE 2.2D-16
[...]
******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HALF ACCURATE *******
EXPECTED RESULT COMPUTED RESULT
1 ( 0.327173 , 0.106893 ) ( 86.5857 , -226.237 )
2 ( 0.357143 , -0.100899 ) ( 104.135 , -124.494 )
3 ( 0.874126E-01, -0.156843 ) ( -34.9246 , 126.088 )
4 ( 0.646853 , -0.292707 ) ( -240.092 , 143.179 )
5 ( 0.477023 , 0.989011E-01) ( -105.109 , -50.2885 )
6 ( 0.749251E-02, 0.242757 ) ( 123.160 , -47.3435 )
7 ( 0.237263 , 0.509491E-01) ( 90.7870 , 14.0902 )
8 ( 0.167333 , 0.306693 ) ( -68.1344 , 28.1545 )
9 ( 0.127373 , -0.356643 ) ( -10.2825 , 137.562 )
10 ( 0.157343 , -0.148851 ) ( -28.5886 , 53.9048 )
11 ( 0.886613 , -0.929071E-01) ( -55.1703 , -115.933 )
12 ( 0.317183 , 0.498501 ) ( -22.1740 , 9.37848 )
13 ( 0.447053 , 0.429570E-01) ( 14.9649 , 112.674 )
14 ( 0.806693 , -0.492507 ) ( -4.46727 , 37.2208 )
15 ( 0.374625E-01, -0.300699 ) ( -25.2919 , 32.4980 )
16 ( 0.966533 , 0.442557 ) ( 5.24627 , -42.9371 )
17 ( 0.596903 , 0.450549 ) ( 23.1122 , 6.00087 )
18 ( 0.926573 , 0.106893 ) ( 34.6113 , -17.4014 )
19 ( 0.686813 , -0.156843 ) ( -7.94232 , -39.8259 )
20 ( 0.117383 , 0.250749 ) ( -10.3488 , 11.0457 )
21 ( 0.247253 , -0.292707 ) ( -30.9430 , -2.04734 )
22 ( 0.774226E-01, 0.989011E-01) ( 15.9532 , -25.4785 )
23 ( 0.606893 , 0.242757 ) ( 10.7604 , 6.09352 )
24 ( 0.766733 , 0.306693 ) ( 2.98340 , -4.96296 )
25 ( 0.397103 , 0.298701 ) ( -1.73568 , -1.03242 )
26 ( 0.726773 , -0.356643 ) ( -10.9512 , -11.0339 )
27 ( 0.756743 , -0.148851 ) ( 10.4933 , 2.67924 )
28 ( 0.487013 , -0.929071E-01) ( -4.98924 , 16.1093 )
29 ( 0.474525E-01, 0.429570E-01) ( 6.81560 , 11.4320 )
30 ( 0.876623 , -0.348651 ) ( 2.01159 , -2.44733 )
31 ( 0.00000 , 0.00000 ) ( -0.374700E-15, 0.207473E-14)
32 ( 0.636863 , -0.300699 ) ( 0.636863 , -0.300699 )
33 ( 0.566933 , 0.442557 ) ( 0.566933 , 0.442557 )
34 ( 0.526973 , 0.106893 ) ( 0.526973 , 0.106893 )
35 ( 0.556943 , -0.100899 ) ( 0.556943 , -0.100899 )
36 ( 0.287213 , -0.156843 ) ( 0.287213 , -0.156843 )
37 ( 0.716783 , 0.250749 ) ( 0.716783 , 0.250749 )
38 ( 0.846653 , -0.292707 ) ( 0.846653 , -0.292707 )
39 ( 0.207293 , 0.242757 ) ( 0.207293 , 0.242757 )
40 ( 0.437063 , 0.509491E-01) ( 0.437063 , 0.509491E-01)
41 ( 0.367133 , 0.306693 ) ( 0.367133 , 0.306693 )
42 ( 0.996503 , 0.298701 ) ( 0.996503 , 0.298701 )
43 ( 0.327173 , -0.356643 ) ( 0.327173 , -0.356643 )
44 ( 0.874126E-01, -0.929071E-01) ( 0.874126E-01, -0.929071E-01)
45 ( 0.516983 , 0.498501 ) ( 0.516983 , 0.498501 )
46 ( 0.646853 , 0.429570E-01) ( 0.646853 , 0.429570E-01)
47 ( 0.477023 , -0.348651 ) ( 0.477023 , -0.348651 )
48 ( 0.749251E-02, -0.492507 ) ( 0.749251E-02, -0.492507 )
49 ( 0.167333 , 0.442557 ) ( 0.167333 , 0.442557 )
50 ( 0.796703 , 0.450549 ) ( 0.796703 , 0.450549 )
51 ( 0.127373 , 0.106893 ) ( 0.127373 , 0.106893 )
52 ( 0.157343 , -0.100899 ) ( 0.157343 , -0.100899 )
53 ( 0.886613 , -0.156843 ) ( 0.886613 , -0.156843 )
54 ( 0.447053 , -0.292707 ) ( 0.447053 , -0.292707 )
55 ( 0.277223 , 0.989011E-01) ( 0.277223 , 0.989011E-01)
56 ( 0.806693 , 0.242757 ) ( 0.806693 , 0.242757 )
57 ( 0.374625E-01, 0.509491E-01) ( 0.374625E-01, 0.509491E-01)
58 ( 0.966533 , 0.306693 ) ( 0.966533 , 0.306693 )
59 ( 0.926573 , -0.356643 ) ( 0.926573 , -0.356643 )
60 ( 0.956543 , -0.148851 ) ( 0.956543 , -0.148851 )
61 ( 0.686813 , -0.929071E-01) ( 0.686813 , -0.929071E-01)
62 ( 0.117383 , 0.498501 ) ( 0.117383 , 0.498501 )
63 ( 0.247253 , 0.429570E-01) ( 0.247253 , 0.429570E-01)
******* ZTRSV FAILED ON CALL NUMBER:
242: ZTRSV ('U','N','U', 63, A, 64, X, 1)
.
--8<---------------cut here---------------end--------------->8---
I will test on armhf as well; currently waiting for gfortran to compile.
Mark
>From 134e0f3bc8cbed258ffa94b484cf57ae6b9cf25c Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Wed, 22 Jul 2015 14:14:52 -0400
Subject: [PATCH] gnu: openblas: Force SICORTEX target for MIPS.
* gnu/packages/patches/openblas-makefile-tests.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/maths.scm (openblas)[source]: Add patch.
[arguments]: Replace #:tests? #f with #:test-target "tests".
Remove #:substitutable?. Add "TARGET=SICORTEX" to make-flags on MIPS.
Co-Authored-By: Ricardo Wurmus <address@hidden>
---
gnu-system.am | 1 +
gnu/packages/maths.scm | 15 ++++++-----
gnu/packages/patches/openblas-makefile-tests.patch | 30 ++++++++++++++++++++++
3 files changed, 39 insertions(+), 7 deletions(-)
create mode 100644 gnu/packages/patches/openblas-makefile-tests.patch
diff --git a/gnu-system.am b/gnu-system.am
index 539a72a..c5f82b7 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -556,6 +556,7 @@ dist_patch_DATA =
\
gnu/packages/patches/nvi-assume-preserve-path.patch \
gnu/packages/patches/nvi-dbpagesize-binpower.patch \
gnu/packages/patches/nvi-db4.patch \
+ gnu/packages/patches/openblas-makefile-tests.patch \
gnu/packages/patches/openexr-missing-samples.patch \
gnu/packages/patches/openssl-runpath.patch \
gnu/packages/patches/orpheus-cast-errors-and-includes.patch \
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 2fc3ce1..dec2b93 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1470,14 +1470,11 @@ constant parts of it.")
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
- "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))))
+ "0av3pd96j8rx5i65f652xv9wqfkaqn0w4ma1gvbyz73i6j2hi9db"))
+ (patches (list (search-patch "openblas-makefile-tests.patch")))))
(build-system gnu-build-system)
(arguments
- `(#:tests? #f ;no "check" target
- ;; DYNAMIC_ARCH is not supported on MIPS. When it is disabled,
- ;; OpenBLAS will tune itself to the build host, so we need to disable
- ;; substitutions.
- #:substitutable? ,(not (string-prefix? "mips" (%current-system)))
+ `(#:test-target "tests"
#:make-flags
(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
"SHELL=bash"
@@ -1486,8 +1483,12 @@ constant parts of it.")
;; switching CPU targets at runtime with the environment variable
;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
;; Unfortunately, this is not supported on MIPS.
+
+ ;; On MIPS we force the SICORTEX TARGET, as for the other two
+ ;; available MIPS targets special Loongson extended instructions
+ ;; are used.
,@(if (string-prefix? "mips" (%current-system))
- '()
+ '("TARGET=SICORTEX")
'("DYNAMIC_ARCH=1")))
;; no configure script
#:phases (alist-delete 'configure %standard-phases)))
diff --git a/gnu/packages/patches/openblas-makefile-tests.patch
b/gnu/packages/patches/openblas-makefile-tests.patch
new file mode 100644
index 0000000..3217601
--- /dev/null
+++ b/gnu/packages/patches/openblas-makefile-tests.patch
@@ -0,0 +1,30 @@
+Fix Makefile to run tests even when TARGET is set.
+Also, do not run tests until we ask for them.
+
+--- xianyi-OpenBLAS-2b0d8a8/Makefile.orig 2015-03-24 16:07:07.000000000
-0400
++++ xianyi-OpenBLAS-2b0d8a8/Makefile 2015-07-22 14:06:47.955139133 -0400
+@@ -25,7 +25,7 @@
+ .PHONY : all libs netlib test ctest shared install
+ .NOTPARALLEL : all libs prof lapack-test install blas-test
+
+-all :: libs netlib tests shared
++all :: libs netlib shared
+ @echo
+ @echo " OpenBLAS build complete. ($(LIB_COMPONENTS))"
+ @echo
+@@ -110,7 +110,6 @@
+
+ tests :
+ ifndef NOFORTRAN
+-ifndef TARGET
+ ifndef CROSS
+ touch $(LIBNAME)
+ ifndef NO_FBLAS
+@@ -124,7 +123,6 @@
+ endif
+ endif
+ endif
+-endif
+
+ libs :
+ ifeq ($(CORE), UNKOWN)
--
2.4.3