Page 1 of 1

Unable to build magmaf.lib

Posted: Mon Nov 09, 2015 12:29 pm
by paoloviviani
Hello,
I successfully built magma.lib on windows with CMake, VS2013 and Intel Fortran, but unfortunately it doesn't contains the magmaf_xxxxx interfaces that I need (I used such interface on Linux for compatibility with legacy code).

I'm aware that a different magmaf.lib library should be built, but I don't know how to achieve that. Does anyone have succeeded in that?

Thanks,
Paolo

Re: Unable to build magmaf.lib

Posted: Tue Nov 10, 2015 6:29 pm
by mgates3
The comment about magmaf.lib is out-of-date. There were a couple Fortran files for the non-symmetric eigenvalue problem, but those have been replaced with C files.

Looking at the Makefile that CMake generates, it appears it should compile the Fortran wrappers, namely control/*f77.cpp. It does not however, compile the F90 interfaces, control/*fortran.F90. These are really just the F90 interfaces; the wrappers themselves (e.g., magmaf_dgetrf) should exist. The reason being a comment in the CMakeLists.txt file:

Code: Select all

if ( WIN32 )
        # Windows seems to have a problem mixing C, CUDA, and Fortran files
        # Currently ignores .f90 and .F90 files, because it doesn't seem to
        # understand that .F90 files should be pre-processed.
You could probably just copy the interfaces you need out of the control/*fortran.F90 files. The only preprocessing they may need is to define magma_devptr_t as integer(kind=8), assuming 64-bit pointers.

-mark

Re: Unable to build magmaf.lib

Posted: Tue Nov 10, 2015 6:47 pm
by paoloviviani
Thanks mark for the quick reply, unfortunately my description of the problem was not exact, in fact I'm interested in the Fortran wrappers contained in control/*f77.cpp, since my code is C++, but uses the Lapack convention (i.e. char* instead of enums).
However it seem that it does not compile the wrappers too, since it gives unresolved symbols when linking to magmaf_xxxxx.

Apart from that I succeeded in implementing a translation layer (like what control/*f77.cpp does) within my code, so I don't need to call the magmaf_xxxxx anymore, but I can call directly the magma_xxxxx functions. Unfortunately this works fine on Linux, but on Windows I get an error from magma_dgesdd (illegal value for parameter number 12, lwork). I can't see where the code is wrong, as it works flawlessly on Linux, so it might be some king of bug. Any idea?
Thanks again,
Paolo

Re: Unable to build magmaf.lib

Posted: Thu Nov 12, 2015 11:40 pm
by mgates3
The lwork depends on jobz, m, n, and nb. What values do you have for those 5 variables? Have you tried querying it, by passing in lwork = -1? There's an example of this in testing_dgesdd.cpp.

Code: Select all

                    lwork = -1;
                    magma_dgesdd( jobz, M, N,
                                  NULL, lda, NULL, NULL, ldu, NULL, ldv, dummy, lwork,
                                  NULL, &info );
                    lwork = (int) MAGMA_D_REAL( dummy[0] );
As for constants, you can of course use the conversion functions, e.g.,

const char * uplo = "Lower";
magma_dpotrf( magma_uplo_const( *uplo ), N, A, lda, &info );

These are documented in the "Constants" section.
http://icl.cs.utk.edu/projectsfiles/mag ... tants.html

-mark

Re: Unable to build magmaf.lib

Posted: Fri Nov 20, 2015 6:02 am
by paoloviviani
Querying magma_dgesdd worked nicely, thanks!