OpenMathLib / OpenBLAS

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
http://www.openblas.net
BSD 3-Clause "New" or "Revised" License
6.32k stars 1.49k forks source link

Can OpenBLAS support QNX? #1646

Closed lilian0118 closed 5 years ago

lilian0118 commented 6 years ago

I want use OpenBLAS on BlackBerry QNX operating systems, so I use QNX qcc to compile OpenBLAS, but some error occur. Can anybody help me?

qcc -Vgcc_ntoarmv7le -O3 -fPIC -O2 -DNO_SYSV_IPC -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_AVX -DNO_AVX2 -DNO_WARMUP -DMAX_CPUNUMBER=1 -DASMNAME=parameter -DASMFNAME=parameter -DNAME=parameter_ -DCNAME=parameter -DCHARNAME=\"parameter\" -DCHAR_CNAME=\"parameter\" -DNO_AFFINITY -I../.. -c parameter.c -o parameter.o parameter.c: In function 'blas_set_parameter': parameter.c:257:7: warning: unused variable 'size' [-Wunused-variable] {standard input}: Assembler messages: {standard input}:127: Error: bad instruction xchgl r3,[r2,#28]' {standard input}:250: Error: bad instructionxchgl r3,[r4,#28]' {standard input}:327: Error: bad instruction xchgl r3,[r2,#0]' {standard input}:363: Error: bad instructionxchgl r4,[r2,#0]' {standard input}:461: Error: bad instruction xchgl r3,[r2,#28]' {standard input}:529: Error: bad instructionxchgl r3,[r1,#28]' cc: /home/groupadmin/qnx660/host/linux/x86/usr/bin/arm-unknown-nto-qnx6.6.0eabi-as error 1 make[1]: [memory.o] Error 1 make[1]: Waiting for unfinished jobs....

martin-frbg commented 6 years ago

I am not aware of anybody who has tried this before, but the error you are getting looks more like the assembler you use (the arm-unknown-nto-qnx6.6.0eabi-as) is too old to understand the code that your qcc generates (or perhaps you invoked the wrong version of qcc on your machine).

brada4 commented 6 years ago

Maybe worth trying CC=something-gcc http://www.qnx.com/developers/docs/6.5.0SP1.update/com.qnx.doc.neutrino_utilities/g/gcc.html can you try if QNX x86_64 works?

brada4 commented 6 years ago

xchgl is x86_64 instruction, ARM assembler justly rejects it. What build parameters you use?

lilian0118 commented 6 years ago

I use below build parameters.

TARGET=ARMV7 CFLAGS="$CFLAGS -Vgcc_ntoarmv7le"
make ${MAKE_FLAGS} TARGET=$TARGET HOSTCC=gcc CC=qcc CFLAGS="$CFLAGS -O3 -fPIC" NOFORTRAN=1 NUM_THREADS=1 NO_SHARED=1 NO_EXPRECISION=0 BINARY_DEFINED=1 NO_AVX2=1 BINARY=32

brada4 commented 6 years ago

What make parameters you passed? Are you building on native platform or cross-building?

lilian0118 commented 6 years ago

@brada4

I use below build parameters.

TARGET=ARMV7 CFLAGS="$CFLAGS -Vgcc_ntoarmv7le" make ${MAKE_FLAGS} TARGET=$TARGET HOSTCC=gcc CC=qcc CFLAGS="$CFLAGS -O3 -fPIC" NOFORTRAN=1 NUM_THREADS=1 NO_SHARED=1 NO_EXPRECISION=0 BINARY_DEFINED=1 NO_AVX2=1 BINARY=32

brada4 commented 6 years ago

For some strange reason ARM compiler gets x86 assembly Setting variables with names matching OpenBLAS parameters have unpredictable impacts on build system (those parameters are sometimes tried to get read from env) -O3 is not good (check all issues around "clobber registers" , you dont want to land there) Can you use "script" command to record full output from minimal parameters e.g.

$ script
$ make clean
$ make HOSTCC=gcc CC=ntoarm-gcc TARGET=ARMV7
$ exit
<typescript>

EDIT: use gcc directly, though your qcc parameters should invoke it same way.

martin-frbg commented 6 years ago

Perhaps try adding "-v" to the CFLAGS to see exactly which gcc gets called for building parameter.o and memory.o Strange that this is the first file that causes this error, or is it just one error of many similar errors that you picked from the log ? Come to think of it, the assembler error appears to be for a different file than what the last compiler line had. Is it possible that you tried to build for x86 first and did not make clean before retrying with qcc ?