unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Attempt to fix OpenBLAS on MIPS.
@ 2015-07-20 13:11 Ricardo Wurmus
  2015-07-21 15:15 ` Mark H Weaver
  0 siblings, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2015-07-20 13:11 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

Attached is a patch that *might* fix the build of OpenBLAS on MIPS.

The LOONGSON3A and LOONGSON3B targets both enable the use of special
extended instructions which may not be available on other MIPS CPUs.
This patch forces the SICORTEX target to be used, which should limit the
code to only standard MIPS instructions.

I don’t know if this would actually work and I note that SICORTEX is
listed as a “mips” target, rather than “mips64”, so maybe this is doomed
to fail.  I would appreciate it if someone with a MIPS machine could
test this patch.

Thanks in advance!

~~ Ricardo


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-openblas-Force-SICORTEX-target-for-MIPS.patch --]
[-- Type: text/x-patch, Size: 1286 bytes --]

From fd611c8d8ccc5159487a1a80bb7950a8a759cfc6 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Mon, 20 Jul 2015 15:05:55 +0200
Subject: [PATCH] gnu: openblas: Force SICORTEX target for MIPS.

* gnu/packages/maths.scm (openblas)[arguments]: Add "TARGET=SICORTEX" to make
  flags on MIPS.
---
 gnu/packages/maths.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d365481..f2d303a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1485,8 +1485,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)))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-20 13:11 [PATCH] Attempt to fix OpenBLAS on MIPS Ricardo Wurmus
@ 2015-07-21 15:15 ` Mark H Weaver
  2015-07-21 16:48   ` Mark H Weaver
  0 siblings, 1 reply; 10+ messages in thread
From: Mark H Weaver @ 2015-07-21 15:15 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Attached is a patch that *might* fix the build of OpenBLAS on MIPS.
>
> The LOONGSON3A and LOONGSON3B targets both enable the use of special
> extended instructions which may not be available on other MIPS CPUs.
> This patch forces the SICORTEX target to be used, which should limit the
> code to only standard MIPS instructions.
>
> I don’t know if this would actually work and I note that SICORTEX is
> listed as a “mips” target, rather than “mips64”, so maybe this is doomed
> to fail.  I would appreciate it if someone with a MIPS machine could
> test this patch.

With this patch, openblas builds successfully on mips64el, although I
cannot say whether it works, since there are no tests.

Is there a (preferably not huge) package that uses openblas and has a
test suite that I could try?

      Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-21 15:15 ` Mark H Weaver
@ 2015-07-21 16:48   ` Mark H Weaver
  2015-07-22 15:59     ` Ricardo Wurmus
  0 siblings, 1 reply; 10+ messages in thread
From: Mark H Weaver @ 2015-07-21 16:48 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
>> Attached is a patch that *might* fix the build of OpenBLAS on MIPS.
>>
>> The LOONGSON3A and LOONGSON3B targets both enable the use of special
>> extended instructions which may not be available on other MIPS CPUs.
>> This patch forces the SICORTEX target to be used, which should limit the
>> code to only standard MIPS instructions.
>>
>> I don’t know if this would actually work and I note that SICORTEX is
>> listed as a “mips” target, rather than “mips64”, so maybe this is doomed
>> to fail.  I would appreciate it if someone with a MIPS machine could
>> test this patch.
>
> With this patch, openblas builds successfully on mips64el, although I
> cannot say whether it works, since there are no tests.

I've since learned that normally tests are run during the 'build' phase,
but that doesn't seem to be happening anymore on MIPS with this new
patch applied.  Here's the transcript of the end of the build phase:

--8<---------------cut here---------------start------------->8---
ar  -ru ../libopenblas_mipsp-r0.2.14.a samax_k.o samin_k.o smax_k.o smin_k.o isamax_k.o isamin_k.o ismax_k.o ismin_k.o sasum_k.o saxpy_k.o scopy_k.o sdot_k.o sdsdot_k.o dsdot_k.o snrm2_k.o srot_k.o sscal_k.o sswap_k.o saxpby_k.o sgemv_n.o sgemv_t.o ssymv_U.o ssymv_L.o sger_k.o sgemm_kernel.o sgemm_incopy.o sgemm_itcopy.o sgemm_oncopy.o sgemm_otcopy.o sgemm_beta.o strmm_kernel_LN.o strmm_kernel_LT.o strmm_kernel_RN.o strmm_kernel_RT.o strsm_kernel_LN.o strsm_kernel_LT.o strsm_kernel_RN.o strsm_kernel_RT.o strmm_iunucopy.o strmm_iunncopy.o strmm_ilnucopy.o strmm_ilnncopy.o strmm_iutucopy.o strmm_iutncopy.o strmm_iltucopy.o strmm_iltncopy.o strmm_ounucopy.o strmm_ounncopy.o strmm_olnucopy.o strmm_olnncopy.o strmm_outucopy.o strmm_outncopy.o strmm_oltucopy.o strmm_oltncopy.o strsm_iunucopy.o strsm_iunncopy.o strsm_ilnucopy.o strsm_ilnncopy.o strsm_iutucopy.o strsm_iutncopy.o strsm_iltucopy.o strsm_iltncopy.o strsm_ounucopy.o strsm_ounncopy.o strsm_olnucopy.o strsm_olnncopy.o strsm_outucopy.o strsm_outncopy.o strsm_oltucopy.o strsm_oltncopy.o ssymm_iutcopy.o ssymm_iltcopy.o ssymm_outcopy.o ssymm_oltcopy.o somatcopy_k_cn.o somatcopy_k_rn.o somatcopy_k_ct.o somatcopy_k_rt.o sgeadd_k.o damax_k.o damin_k.o dmax_k.o dmin_k.o idamax_k.o idamin_k.o idmax_k.o idmin_k.o dasum_k.o daxpy_k.o dcopy_k.o ddot_k.o dnrm2_k.o drot_k.o dscal_k.o dswap_k.o daxpby_k.o dgemv_n.o dgemv_t.o dsymv_U.o dsymv_L.o dger_k.o dgemm_kernel.o dgemm_incopy.o dgemm_itcopy.o dgemm_oncopy.o dgemm_otcopy.o dgemm_beta.o dtrmm_kernel_LN.o dtrmm_kernel_LT.o dtrmm_kernel_RN.o dtrmm_kernel_RT.o dtrsm_kernel_LN.o dtrsm_kernel_LT.o dtrsm_kernel_RN.o dtrsm_kernel_RT.o dtrmm_iunucopy.o dtrmm_iunncopy.o dtrmm_ilnucopy.o dtrmm_ilnncopy.o dtrmm_iutucopy.o dtrmm_iutncopy.o dtrmm_iltucopy.o dtrmm_iltncopy.o dtrmm_ounucopy.o dtrmm_ounncopy.o dtrmm_olnucopy.o dtrmm_olnncopy.o dtrmm_outucopy.o dtrmm_outncopy.o dtrmm_oltucopy.o dtrmm_oltncopy.o dtrsm_iunucopy.o dtrsm_iunncopy.o dtrsm_ilnucopy.o dtrsm_ilnncopy.o dtrsm_iutucopy.o dtrsm_iutncopy.o dtrsm_iltucopy.o dtrsm_iltncopy.o dtrsm_ounucopy.o dtrsm_ounncopy.o dtrsm_olnucopy.o dtrsm_olnncopy.o dtrsm_outucopy.o dtrsm_outncopy.o dtrsm_oltucopy.o dtrsm_oltncopy.o dsymm_iutcopy.o dsymm_iltcopy.o dsymm_outcopy.o dsymm_oltcopy.o domatcopy_k_cn.o domatcopy_k_rn.o domatcopy_k_ct.o domatcopy_k_rt.o dgeadd_k.o camax_k.o camin_k.o icamax_k.o icamin_k.o casum_k.o caxpy_k.o caxpyc_k.o ccopy_k.o cdotc_k.o cdotu_k.o cnrm2_k.o csrot_k.o cscal_k.o cswap_k.o caxpby_k.o cgemv_n.o cgemv_t.o cgemv_r.o cgemv_c.o cgemv_o.o cgemv_u.o cgemv_s.o cgemv_d.o csymv_U.o csymv_L.o chemv_U.o chemv_L.o chemv_V.o chemv_M.o cgeru_k.o cgerc_k.o cgerv_k.o cgerd_k.o cgemm_kernel_n.o cgemm_kernel_r.o cgemm_kernel_l.o cgemm_kernel_b.o cgemm_incopy.o cgemm_itcopy.o cgemm_oncopy.o cgemm_otcopy.o cgemm_beta.o ctrmm_kernel_LN.o ctrmm_kernel_LT.o ctrmm_kernel_LR.o ctrmm_kernel_LC.o ctrmm_kernel_RN.o ctrmm_kernel_RT.o ctrmm_kernel_RR.o ctrmm_kernel_RC.o ctrsm_kernel_LN.o ctrsm_kernel_LT.o ctrsm_kernel_LR.o ctrsm_kernel_LC.o ctrsm_kernel_RN.o ctrsm_kernel_RT.o ctrsm_kernel_RR.o ctrsm_kernel_RC.o ctrmm_iunucopy.o ctrmm_iunncopy.o ctrmm_ilnucopy.o ctrmm_ilnncopy.o ctrmm_iutucopy.o ctrmm_iutncopy.o ctrmm_iltucopy.o ctrmm_iltncopy.o ctrmm_ounucopy.o ctrmm_ounncopy.o ctrmm_olnucopy.o ctrmm_olnncopy.o ctrmm_outucopy.o ctrmm_outncopy.o ctrmm_oltucopy.o ctrmm_oltncopy.o ctrsm_iunucopy.o ctrsm_iunncopy.o ctrsm_ilnucopy.o ctrsm_ilnncopy.o ctrsm_iutucopy.o ctrsm_iutncopy.o ctrsm_iltucopy.o ctrsm_iltncopy.o ctrsm_ounucopy.o ctrsm_ounncopy.o ctrsm_olnucopy.o ctrsm_olnncopy.o ctrsm_outucopy.o ctrsm_outncopy.o ctrsm_oltucopy.o ctrsm_oltncopy.o csymm_iutcopy.o csymm_iltcopy.o csymm_outcopy.o csymm_oltcopy.o chemm_iutcopy.o chemm_iltcopy.o chemm_outcopy.o chemm_oltcopy.o comatcopy_k_cn.o comatcopy_k_rn.o comatcopy_k_ct.o comatcopy_k_rt.o comatcopy_k_cnc.o comatcopy_k_rnc.o comatcopy_k_ctc.o comatcopy_k_rtc.o cgeadd_k.o zamax_k.o zamin_k.o izamax_k.o izamin_k.o zasum_k.o zaxpy_k.o zaxpyc_k.o zcopy_k.o zdotc_k.o zdotu_k.o znrm2_k.o zdrot_k.o zscal_k.o zswap_k.o zaxpby_k.o zgemv_n.o zgemv_t.o zgemv_r.o zgemv_c.o zgemv_o.o zgemv_u.o zgemv_s.o zgemv_d.o zsymv_U.o zsymv_L.o zhemv_U.o zhemv_L.o zhemv_V.o zhemv_M.o zgeru_k.o zgerc_k.o zgerv_k.o zgerd_k.o zgemm_kernel_n.o zgemm_kernel_r.o zgemm_kernel_l.o zgemm_kernel_b.o zgemm_incopy.o zgemm_itcopy.o zgemm_oncopy.o zgemm_otcopy.o zgemm_beta.o ztrmm_kernel_LN.o ztrmm_kernel_LT.o ztrmm_kernel_LR.o ztrmm_kernel_LC.o ztrmm_kernel_RN.o ztrmm_kernel_RT.o ztrmm_kernel_RR.o ztrmm_kernel_RC.o ztrsm_kernel_LN.o ztrsm_kernel_LT.o ztrsm_kernel_LR.o ztrsm_kernel_LC.o ztrsm_kernel_RN.o ztrsm_kernel_RT.o ztrsm_kernel_RR.o ztrsm_kernel_RC.o ztrmm_iunucopy.o ztrmm_iunncopy.o ztrmm_ilnucopy.o ztrmm_ilnncopy.o ztrmm_iutucopy.o ztrmm_iutncopy.o ztrmm_iltucopy.o ztrmm_iltncopy.o ztrmm_ounucopy.o ztrmm_ounncopy.o ztrmm_olnucopy.o ztrmm_olnncopy.o ztrmm_outucopy.o ztrmm_outncopy.o ztrmm_oltucopy.o ztrmm_oltncopy.o ztrsm_iunucopy.o ztrsm_iunncopy.o ztrsm_ilnucopy.o ztrsm_ilnncopy.o ztrsm_iutucopy.o ztrsm_iutncopy.o ztrsm_iltucopy.o ztrsm_iltncopy.o ztrsm_ounucopy.o ztrsm_ounncopy.o ztrsm_olnucopy.o ztrsm_olnncopy.o ztrsm_outucopy.o ztrsm_outncopy.o ztrsm_oltucopy.o ztrsm_oltncopy.o zsymm_iutcopy.o zsymm_iltcopy.o zsymm_outcopy.o zsymm_oltcopy.o zhemm_iutcopy.o zhemm_iltcopy.o zhemm_outcopy.o zhemm_oltcopy.o zomatcopy_k_cn.o zomatcopy_k_rn.o zomatcopy_k_ct.o zomatcopy_k_rt.o zomatcopy_k_cnc.o zomatcopy_k_rnc.o zomatcopy_k_ctc.o zomatcopy_k_rtc.o zgeadd_k.o lsame.o scabs1.o dcabs1.o
ar: `u' modifier ignored since `D' is the default (see `U')
make[1]: Leaving directory '/tmp/nix-build-openblas-0.2.14.drv-0/xianyi-OpenBLAS-2b0d8a8/kernel'
make[1]: warning: -jN forced in submake: disabling jobserver mode.
make[1]: Entering directory '/tmp/nix-build-openblas-0.2.14.drv-0/xianyi-OpenBLAS-2b0d8a8/exports'
perl ./gensymbol linktest  mips64 _ 0 0 1 1 0 0 "" "" > linktest.c
gcc -O2 -Wall -mabi=n32 -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=4 -DUSE_SIMPLE_THREADED_LEVEL3 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I..  -shared -o ../libopenblas_mipsp-r0.2.14.so \
-Wl,--whole-archive ../libopenblas_mipsp-r0.2.14.a -Wl,--no-whole-archive \
-Wl,-soname,libopenblas.so.0 -lm -lpthread -lm -lpthread
gcc -O2 -Wall -mabi=n32 -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=4 -DUSE_SIMPLE_THREADED_LEVEL3 -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I..  -w -o linktest linktest.c ../libopenblas_mipsp-r0.2.14.so  && echo OK.
OK.
rm -f linktest
make[1]: Leaving directory '/tmp/nix-build-openblas-0.2.14.drv-0/xianyi-OpenBLAS-2b0d8a8/exports'

 OpenBLAS build complete. (BLAS CBLAS)

  OS               ... Linux             
  Architecture     ... mips64               
  BINARY           ... 32bit                 
  C compiler       ... GCC  (command line : gcc)
  Fortran compiler ... GFORTRAN  (command line : gfortran)
  Library Name     ... libopenblas_mipsp-r0.2.14.a (Multi threaded; Max num-threads is 4)

To install the library, you can run "make PREFIX=/path/to/your/installation install".

phase `build' succeeded after 1098 seconds
--8<---------------cut here---------------end--------------->8---

     Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-21 16:48   ` Mark H Weaver
@ 2015-07-22 15:59     ` Ricardo Wurmus
  2015-07-22 17:19       ` Andreas Enge
  0 siblings, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2015-07-22 15:59 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel


Mark H Weaver <mhw@netris.org> writes:

>> With this patch, openblas builds successfully on mips64el, although I
>> cannot say whether it works, since there are no tests.
>
> I've since learned that normally tests are run during the 'build' phase,
> but that doesn't seem to be happening anymore on MIPS with this new
> patch applied.  Here's the transcript of the end of the build phase:

The test target appears to only do something if TARGET is not set:

~~~~~~
tests :
ifndef NOFORTRAN
ifndef TARGET
ifndef CROSS
	touch $(LIBNAME)
ifndef NO_FBLAS
	$(MAKE) -C test all
ifdef UTEST_CHECK
	$(MAKE) -C utest all
endif
endif
ifndef NO_CBLAS
	$(MAKE) -C ctest all
endif
endif
endif
endif
~~~~~~

Since we do pass TARGET=SICORTEX the tests are skipped.  I don’t know if
there’s a good reason for this.

~~ Ricardo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-22 15:59     ` Ricardo Wurmus
@ 2015-07-22 17:19       ` Andreas Enge
  2015-07-22 20:02         ` Mark H Weaver
  0 siblings, 1 reply; 10+ messages in thread
From: Andreas Enge @ 2015-07-22 17:19 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

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.

Andreas

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-22 17:19       ` Andreas Enge
@ 2015-07-22 20:02         ` Mark H Weaver
  2015-07-22 20:07           ` Mark H Weaver
  2015-07-23  1:28           ` Mark H Weaver
  0 siblings, 2 replies; 10+ messages in thread
From: Mark H Weaver @ 2015-07-22 20:02 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 6631 bytes --]

Andreas Enge <andreas@enge.fr> 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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] gnu: openblas: Force SICORTEX target for MIPS --]
[-- Type: text/x-patch, Size: 4159 bytes --]

From 134e0f3bc8cbed258ffa94b484cf57ae6b9cf25c Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
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 <ricardo.wurmus@mdc-berlin.de>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-22 20:02         ` Mark H Weaver
@ 2015-07-22 20:07           ` Mark H Weaver
  2015-08-24 12:28             ` Ricardo Wurmus
  2015-07-23  1:28           ` Mark H Weaver
  1 sibling, 1 reply; 10+ messages in thread
From: Mark H Weaver @ 2015-07-22 20:07 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Andreas Enge <andreas@enge.fr> 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:

Sorry, I didn't look closely enough.  Actually, on MIPS the build later
aborted due to 1 hour of silence in the middle of the test suite:

--8<---------------cut here---------------start------------->8---
OPENBLAS_NUM_THREADS=2 ./sblat2 < ./sblat2.dat
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./dblat3 < ./dblat3.dat
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./cblat3 < ./cblat3.dat
OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./zblat3 < ./zblat3.dat
rm -f ?BLAT3.SUMM
OPENBLAS_NUM_THREADS=2 ./sblat3 < ./sblat3.dat
building of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' timed out after 3600 seconds of silence
@ build-failed /gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv - timeout
note: keeping build directory `/tmp/nix-build-openblas-0.2.14.drv-0'
killing process 16081
guix build: error: build failed: build of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' failed
--8<---------------cut here---------------end--------------->8---

       Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-22 20:02         ` Mark H Weaver
  2015-07-22 20:07           ` Mark H Weaver
@ 2015-07-23  1:28           ` Mark H Weaver
  1 sibling, 0 replies; 10+ messages in thread
From: Mark H Weaver @ 2015-07-23  1:28 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> writes:
> I will test on armhf as well; currently waiting for gfortran to compile.

And here's what happens on armhf:

--8<---------------cut here---------------start------------->8---
gcc -O2 -Wall -DF_INTERFACE_GFORT -fPIC -DDYNAMIC_ARCH -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=2 -marm -mfpu=vfpv3  -mfloat-abi=hard -march=armv7-a -DASMNAME=dynamic -DASMFNAME=dynamic_ -DNAME=dynamic_ -DCNAME=dynamic -DCHAR_NAME=\"dynamic_\" -DCHAR_CNAME=\"dynamic\" -DNO_AFFINITY -I../.. -c dynamic.c -o dynamic.o
dynamic.c: In function ‘support_avx’:
dynamic.c:105:3: warning: implicit declaration of function ‘cpuid’ [-Wimplicit-function-declaration]
   cpuid(1, &eax, &ebx, &ecx, &edx);
   ^
dynamic.c:95:3: error: impossible constraint in ‘asm’
   __asm__ __volatile__
   ^
Makefile:83: recipe for target 'dynamic.o' failed
make[1]: *** [dynamic.o] Error 1
make[1]: Leaving directory '/tmp/nix-build-openblas-0.2.14.drv-0/xianyi-OpenBLAS-2b0d8a8/driver/others'
Makefile:141: recipe for target 'libs' failed
make: *** [libs] Error 1
phase `build' failed after 619 seconds
note: keeping build directory `/tmp/nix-build-openblas-0.2.14.drv-0'
builder for `/gnu/store/bxzwwlg9n5ali25k0mypfmfq3rl81g0l-openblas-0.2.14.drv' failed with exit code 1
@ build-failed /gnu/store/bxzwwlg9n5ali25k0mypfmfq3rl81g0l-openblas-0.2.14.drv - 1 builder for `/gnu/store/bxzwwlg9n5ali25k0mypfmfq3rl81g0l-openblas-0.2.14.drv' failed with exit code 1
killing process 6213
guix build: error: build failed: build of `/gnu/store/bxzwwlg9n5ali25k0mypfmfq3rl81g0l-openblas-0.2.14.drv' failed
mhw@novena:~$
--8<---------------cut here---------------end--------------->8---

      Mark

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-07-22 20:07           ` Mark H Weaver
@ 2015-08-24 12:28             ` Ricardo Wurmus
  2015-09-24  8:27               ` Ricardo Wurmus
  0 siblings, 1 reply; 10+ messages in thread
From: Ricardo Wurmus @ 2015-08-24 12:28 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Hi Mark,

Mark H Weaver <mhw@netris.org> writes:

> Mark H Weaver <mhw@netris.org> writes:
>
>> Andreas Enge <andreas@enge.fr> 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:
>
> Sorry, I didn't look closely enough.  Actually, on MIPS the build later
> aborted due to 1 hour of silence in the middle of the test suite:
>
> --8<---------------cut here---------------start------------->8---
> OPENBLAS_NUM_THREADS=2 ./sblat2 < ./sblat2.dat
> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./dblat3 < ./dblat3.dat
> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./cblat3 < ./cblat3.dat
> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./zblat3 < ./zblat3.dat
> rm -f ?BLAT3.SUMM
> OPENBLAS_NUM_THREADS=2 ./sblat3 < ./sblat3.dat
> building of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' timed out after 3600 seconds of silence
> @ build-failed /gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv - timeout
> note: keeping build directory `/tmp/nix-build-openblas-0.2.14.drv-0'
> killing process 16081
> guix build: error: build failed: build of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' failed
> --8<---------------cut here---------------end--------------->8---

Have you been able to try this again with a larger silent timeout value?
I would like to know if the patch (+ explicitly enabling tests on MIPS)
is sufficient to fix OpenBLAS on MIPS, or if I should discuss more with
upstream.

~~ Ricardo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Attempt to fix OpenBLAS on MIPS.
  2015-08-24 12:28             ` Ricardo Wurmus
@ 2015-09-24  8:27               ` Ricardo Wurmus
  0 siblings, 0 replies; 10+ messages in thread
From: Ricardo Wurmus @ 2015-09-24  8:27 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Hi Mark,

>>>> 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:
>>
>> Sorry, I didn't look closely enough.  Actually, on MIPS the build later
>> aborted due to 1 hour of silence in the middle of the test suite:
>>
>> --8<---------------cut here---------------start------------->8---
>> OPENBLAS_NUM_THREADS=2 ./sblat2 < ./sblat2.dat
>> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./dblat3 < ./dblat3.dat
>> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./cblat3 < ./cblat3.dat
>> OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 ./zblat3 < ./zblat3.dat
>> rm -f ?BLAT3.SUMM
>> OPENBLAS_NUM_THREADS=2 ./sblat3 < ./sblat3.dat
>> building of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' timed out after 3600 seconds of silence
>> @ build-failed /gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv - timeout
>> note: keeping build directory `/tmp/nix-build-openblas-0.2.14.drv-0'
>> killing process 16081
>> guix build: error: build failed: build of `/gnu/store/974lvn8v6sxvqhlm57n8x6fiqv6xn6dh-openblas-0.2.14.drv' failed
>> --8<---------------cut here---------------end--------------->8---
>
> Have you been able to try this again with a larger silent timeout value?
> I would like to know if the patch (+ explicitly enabling tests on MIPS)
> is sufficient to fix OpenBLAS on MIPS, or if I should discuss more with
> upstream.

I’m just pinging again, because this patch still sits in my queue.  Can
we use this patch to fix the build of OpenBLAS on MIPS?

As OpenBLAS is an (indirect) input of many failing packages on MIPS I’m
interested in seeing this merged.

~~ Ricardo

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-09-24  8:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 13:11 [PATCH] Attempt to fix OpenBLAS on MIPS Ricardo Wurmus
2015-07-21 15:15 ` Mark H Weaver
2015-07-21 16:48   ` Mark H Weaver
2015-07-22 15:59     ` Ricardo Wurmus
2015-07-22 17:19       ` Andreas Enge
2015-07-22 20:02         ` Mark H Weaver
2015-07-22 20:07           ` Mark H Weaver
2015-08-24 12:28             ` Ricardo Wurmus
2015-09-24  8:27               ` Ricardo Wurmus
2015-07-23  1:28           ` Mark H Weaver

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).