Skip to content

ILP64 OpenBLAS gives different result from regular OpenBLAS #2779

@Zha0q1

Description

@Zha0q1

ILP64 OpenBLAS built with

CXX="g++ -fPIC" CC="gcc -fPIC" make -j DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 USE_OPENMP=1 INTERFACE64=1 BINARY=64 NO_SHARED=0 NO_LAPACK=0
#include <iostream>
#include <cblas.h>
int main ( int argc, char* argv[] ) {
    const long n = ((long)1 << 31) - 1;
    std::cout << n <<std::endl;
    float*  A = new float[n];
    float*  B = new float[n];
    float*  C = new float[1];
    for(long i =0; i <n; i++){
        A[i] = 1;
        B[i] = 1;

    }
    cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 1, 1, n,  1.0, A, n, B, 1, 0.0, C, 1);
    std::cout << *C <<std::endl;
    delete[] A;
    delete[] B;
    delete[] C;
    return 0;
}

Compiled with g++ gemm.cpp -I /usr/local/include/ -lopenblas

On ILP64 OpenBLAS machine:

2147483647
1.93274e+09

On vanilla OpenBLAS machine:

2147483647
2.14748e+09

I think I am linking correctly, because if I change n to (long)1 << 31) + 1, then
ILP64

2147483649
1.93274e+09

Vanilla

2147483649
 ** On entry to SGEMM  parameter number  5 had an illegal value
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions