magma_f77.cpp does not use capitalized names for some functions meant to be exposed to Fortran

Issue #71 resolved
Andrew Cunningham created an issue

#define magmaf_smalloc FORTRAN_NAME( magmaf_smalloc, MAGMAF_smalloc )

For example, above. When linking to external libraries Fortran expects functions names to be ALL CAPS. So this should become
#define magmaf_smalloc FORTRAN_NAME( magmaf_smalloc, MAGMAF_SMALLOC )

A workaround, obviously is to manually fix the code as I had to do.

Comments (6)

  1. Andrew Cunningham reporter

    ifort on Windows.

    I realize that ifort has a compiler option called “/names:{uppercase|lowercase|as_is}” to control the interpretation, but the safe option is to assume the “all external routines are upper case” option.

    So for example , I had in my code
    CALL MAGMAF_free
    By default, the linker will be looking for MAGMAF_FREE

    Looking at magma_f77.cpp it looks to me that the MAGMA team has not been able to make up it’s mind either ?

    // -----------------------------------------------------------------------------
    // CPU regular (non-pinned) allocation
    
    #define magmaf_malloc_cpu FORTRAN_NAME( magmaf_malloc_cpu, MAGMAF_MALLOC_CPU )
    magma_int_t magmaf_malloc_cpu( void** ptr, magma_int_t* bytes )
    {
        return magma_malloc_cpu( ptr, *bytes );
    }
    
    #define magmaf_smalloc_cpu FORTRAN_NAME( magmaf_smalloc_cpu, MAGMAF_smalloc_cpu )
    magma_int_t magmaf_smalloc_cpu( float** ptr, magma_int_t* n )
    {
        return magma_smalloc_cpu( ptr, *n );
    }
    

  2. Mark Gates

    They are meant to be uppercase. The mixed case instances are bugs. They’ve been there since 2018, so it seems no one uses those routines from Fortran on Windows.

  3. Andrew Cunningham reporter

    OK, good to know. I guess people just fix it themselves and don't bother to file a bug report!

  4. Log in to comment