Skip to content

OpenBLAS 0.2.18 does not compile with PGI #908

@cparrott73

Description

@cparrott73

Running into several issues with trying to compile on x86-64 based Linux system with PGI:

  1. lapack/potf2/zpotf2_L.c fails with an 'Illegal lvalue' error:

pgcc -c -O2 -DMAX_STACK_ALLOC=2048 -mp -tp p7-64 -DF_INTERFACE_PGI -fPIC -DDYNAMIC_ARCH -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=4 -DASMNAME=zpotf2_L -DASMFNAME=zpotf2_L_ -DNAME=zpotf2_L_ -DCNAME=zpotf2_L -DCHAR_NAME=\"zpotf2_L_\" -DCHAR_CNAME=\"zpotf2_L\" -DNO_AFFINITY -I../.. -DDOUBLE -DCOMPLEX -DCOMPLEX -DDOUBLE zpotf2_L.c -o zpotf2_L.o
PGC-S-0058-Illegal lvalue (zpotf2_L.c: 71)
PGC/x86-64 Linux Rel Dev-r117179: compilation completed with severe errors

This error also occurs with zpotf2_U.c.

Problem seems to be related to this construct, in common.h:

#if defined(C_PGI) || defined(C_SUN)
#define CREAL(X) (*((FLOAT *)&X + 0))
#define CIMAG(X) (*((FLOAT *)&X + 1))

If I change the code in zpotf2_L.c to use the standard C99 complex macros creal() and cimag(), the error goes away.

This problem also affects lapack/lauu2/zlauu2_L.c and lapack/lauu2/zlauu2_U.c.

  1. kernel/x86_64/cdot.c fails to compile:

pgcc -c -O2 -DMAX_STACK_ALLOC=2048 -mp -tp p7-64 -DF_INTERFACE_PGI -fPIC -DDYNAMIC_ARCH -DSMP_SERVER -DUSE_OPENMP -DNO_WARMUP -DMAX_CPU_NUMBER=4 -DASMNAME=cdotc_k_SANDYBRIDGE -DASMFNAME=cdotc_k_SANDYBRIDGE_ -DNAME=cdotc_k_SANDYBRIDGE_ -DCNAME=cdotc_k_SANDYBRIDGE -DCHAR_NAME=\"cdotc_k_SANDYBRIDGE_\" -DCHAR_CNAME=\"cdotc_k_SANDYBRIDGE\" -DNO_AFFINITY -DTS=_SANDYBRIDGE -I.. -DBUILD_KERNEL -DTABLE_NAME=gotoblas_SANDYBRIDGE -UDOUBLE -DCOMPLEX -DCOMPLEX -UDOUBLE -DCONJ ../kernel/x86_64/cdot.c -o cdotc_k_SANDYBRIDGE.o
PGC-S-0040-Illegal use of symbol, __real__ (../kernel/x86_64/cdot.c: 103)
PGC-W-0156-Type not specified, 'int' assumed (../kernel/x86_64/cdot.c: 103)
PGC-S-0040-Illegal use of symbol, __imag__ (../kernel/x86_64/cdot.c: 104)
PGC-W-0156-Type not specified, 'int' assumed (../kernel/x86_64/cdot.c: 104)
PGC-S-0043-Redefinition of symbol, result (../kernel/x86_64/cdot.c: 104)
PGC-S-0040-Illegal use of symbol, __real__ (../kernel/x86_64/cdot.c: 167)
PGC-W-0156-Type not specified, 'int' assumed (../kernel/x86_64/cdot.c: 167)
PGC-S-0043-Redefinition of symbol, result (../kernel/x86_64/cdot.c: 167)
PGC-S-0040-Illegal use of symbol, __imag__ (../kernel/x86_64/cdot.c: 168)
PGC-W-0156-Type not specified, 'int' assumed (../kernel/x86_64/cdot.c: 168)
PGC-S-0043-Redefinition of symbol, result (../kernel/x86_64/cdot.c: 168)
PGC/x86-64 Linux Rel Dev-r117182: compilation completed with severe errors
make[1]: *** [cdotc_k_SANDYBRIDGE.o] Error 2

This is due to the use of a GNU-specific extension for C99 complex datatypes, which is not supported by PGI:

__real__ result = 0.0 ;
__imag__ result = 0.0 ;

One can fix this by changing the above as follows, to comply with the C99 standard:

result = 0.0 + _Complex_I*0.0;

This also affects kernel/x86_64/zdot.c.

Could you fix these issues for the next release? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions