trying to build magma-2.1.0 on Windows

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)

trying to build magma-2.1.0 on Windows

Postby Fractarno » Sun Nov 06, 2016 10:02 am

I'm currently trying to build magma-2.1.0 on Windows. My impression is that magma seems to be a great library but it takes very long to get it running on Windows. Especially it seems not easy to configure the build in the right way.

My environment is Windows 10, CUDA 7.5, Microsoft Visual Studio 11.0. I’ve downloaded LAPACK and BLAS from http://www.fi.muni.cz/~xsvobod2/misc/lapack/ and the Intel Redistributable package from http://software.intel.com/en-us/article ... or-windows

The first problem is that on 64-bit Windows systems, 32-bit versions of the CUDA Toolkit scientific libraries, including cuBLAS, cuSPARSE, cuFFT, cuRAND, etc. are no longer supported by the CUDA toolkit for CUDA >= 7.0.

So I’ve tried to use CMAKE to configure the build with older CUDA versions (e.g. CUDA 6.5) and was somehow successful to generate a 32-bit build of the libraries! Then I’ve created an application with dense linear algebra and it runs perfectly fine, gives the right results and it is really fast!!

The bad news is, that when trying to generate a sparse linear algebra application I get linker errors like magma_sparse.lib(magma_smconverter.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "_cusparseCreateIdentityPermutation@12" in Funktion "_magma_smconvert".

So I’m now trying to generate a 64bit build but I’m failing how to properly configure the build …

Are there pre-built binaries available for download? Or, at least a more detailed guideline how to configure the build in a similar environment?

Thanks for help,

Arno
Fractarno
 
Posts: 5
Joined: Sun Nov 06, 2016 9:25 am

Re: trying to build magma-2.1.0 on Windows

Postby mgates3 » Mon Nov 07, 2016 9:11 pm

Why are you building a 32-bit build of MAGMA? Not that it shouldn't work, but if the other libraries are 64-bit (CUDA, BLAS, LAPACK), there's no real reason to use 32-bit.

cusparseCreateIdentityPermutation was added in CUDA 7.0. However, that call should be disabled if compiled with CUDA < 7.0. (See sparse/control/magma_zmconverter.cpp, has #if CUDA_VERSION >= 7000 around that section.)

-mark
Last edited by mgates3 on Mon Nov 07, 2016 9:55 pm, edited 1 time in total.
Reason: note that code should still compile for cuda < 7.0
mgates3
 
Posts: 750
Joined: Fri Jan 06, 2012 2:13 pm

Re: trying to build magma-2.1.0 on Windows

Postby Fractarno » Sun Nov 13, 2016 5:25 pm

Mark – many thanks for your reply!
The first reason going for 32 bit was that for I need to generate a 32bit dll at the end. Disabling the call you mentioned unfortunately still did not resolve the problem (there are still a lot of linker errors).

The second reason is that I’m still failing when trying to compile 64bit. I’ve tried to configure the build via cmake using the default settings (and adding the path to those 64-bit libraries which cmake didn’t find by itself):

Building without Fortran compiler
Using -DADD_ for Fortran calling convention
Found OpenMP
OpenMP_C_FLAGS /openmp
OpenMP_CXX_FLAGS /openmp
Found CUDA 7.5
CUDA_INCLUDE_DIRS: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/include
CUDA_CUDART_LIBRARY: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64/cudart.lib
compile for CUDA arch 2.x (Fermi)
compile for CUDA arch 3.0 (Kepler)
compile for CUDA arch 3.5 (Kepler)
Define -DHAVE_CUBLAS -DMIN_CUDA_ARCH=200
User set LAPACK_LIBRARIES. To change, edit LAPACK_LIBRARIES using ccmake (set to empty to enable search).
BLAS_LIBRARIES:
LAPACK_LIBRARIES: C:\Users\arno\Documents\Visual Studio 2012\Projects\magma-2.1.0\extra\cbia.lib.lapack.dyn.rel.x64.12.lib
MKLROOT not set. To change, set MKLROOT using ccmake.
Flags
CFLAGS /DWIN32 /D_WINDOWS -DADD_ /openmp -W4 -MP -DMAGMA_NOAFFINITY
CXXFLAGS /DWIN32 /D_WINDOWS /GR /EHsc -DADD_ /openmp -W4 -MP -DMAGMA_NOAFFINITY
NFLAGS -DHAVE_CUBLAS -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_35,code=compute_35 -DADD_
FFLAGS /W1 /nologo /fpp /libs:dll /threads
LIBS tester;lapacktest;magma
LIBS_SPARSE tester;lapacktest;magma;magma_sparse
Configuring done
Generating done

Then, when opening magma.sln in Visual Studio, everything seems to be prepared for 32bit(?). I can change to 64bit and compiling works but still linking fails (it seems to me that NVCC is still compiling 32bit…?!):

CMakeFiles\magma.dir\magmablas\Release\magma_generated_zaxpycp.cu.obj : fatal error LNK1112: Modul-Computertyp "X86" steht in Konflikt mit dem Zielcomputertyp "x64"

So I still would be grateful if I could get some support how to properly configure the 64-bit build in a similar environment or - even better - to get pre-built binaries available for download?

Regards Arno
Fractarno
 
Posts: 5
Joined: Sun Nov 06, 2016 9:25 am

Re: trying to build magma-2.1.0 on Windows

Postby mgates3 » Tue Nov 15, 2016 6:28 pm

Are you re-running CMake with the same build directory? That might cause problems if it caches some information like the compiler to use. I would suggest creating a new build directory when making significant changes in CMake.

Otherwise, we simply follow the directions in README-Windows.

Sorry, we don't provide pre-built binaries for any OS. One reason is there are a lot of combinations of external libraries and features -- which CUDA version, CUDA architectures, C/C++/Fortran compiler, version of LAPACK / BLAS, version of Windows, 32 or 64-bit, with or without OpenMP. Any pre-built library would necessarily pick one set of those and thus be of limited use.

-mark
mgates3
 
Posts: 750
Joined: Fri Jan 06, 2012 2:13 pm

Re: trying to build magma-2.1.0 on Windows

Postby Fractarno » Fri Nov 18, 2016 5:05 pm

I’ve now created a new directory and tried the configuration “Visual Studio 11 Win64” which seems to fit to my installation (all other 64bit configurations fail). Cmake seems to find everything. However, in Visual Studio I always get the error:

nvcc fatal : Microsoft Visual Studio configuration file 'vcvars64.bat' could not be found for installation at 'C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/../..'

What is vcvars64.bat (I couldn't find it on my system...)?
Fractarno
 
Posts: 5
Joined: Sun Nov 06, 2016 9:25 am

Re: trying to build magma-2.1.0 on Windows

Postby mgates3 » Sat Nov 19, 2016 5:21 pm

Try Googling the error message; there seem to be some posts about it on programming and NVIDIA forums.
-mark
mgates3
 
Posts: 750
Joined: Fri Jan 06, 2012 2:13 pm

Re: trying to build magma-2.1.0 on Windows

Postby Fractarno » Sun Nov 20, 2016 6:52 am

In the meantime for 32bit everything works fine for me (the examples work well and I can generate my own application - but I had to go back to CUDA6.5). As I have to deliver a 32bit dll in the end, this does the job for the moment.
For 64bit I still have the same troubles, so if somebody knows how to compile with Visual Studio 11 and CUDA 7.5, any help is highly appreciated. Kind regards, Arno
Fractarno
 
Posts: 5
Joined: Sun Nov 06, 2016 9:25 am

Re: trying to build magma-2.1.0 on Windows

Postby Fractarno » Sun Dec 11, 2016 5:24 am

After some upgrades (Visual Studio Community 2015 / CMake 3.7.1 / magma-2.2.0 / cuda 8.0) I’ve now finally (!) been successful compiling the 64bit Version of magma on Windows. :)
Maybe it is of interest to note that:

CMake was always started from the VS2015 x64 Native Tools Command Prompt.
For clapack and magma I’ve used the configuration: Visual Studio 14 2015 64bit

Lapack:
Since I don’t use Fortran, I’ve downloaded the clapack version from http://icl.cs.utk.edu/lapack-for-window ... -CMAKE.tgz and compiled it with Visual Studio 14 2015 64bit (all prebuilt libraries I’ve tried always resulted in linking errors – maybe due to the absence of fortran libraries on my system …?!).

Magma:
Important was changing the C Flags from /MD to /MT (otherwise I got a linking error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'…obviously because the cuda-objects were built differently than the CXX objects)
Lapack libraries: I’ve included blas.lib, lapack.lib and also tmglib.lib and libf2c.lib

Building my own application:
I’ve started with an empty project and then (after adding the include paths to magma and adding magma-libs and lapack-libs) I consequently changed Code Generation to Multi-threaded (/MT). Additionally I’ve added some Preprocessor definitions (copied from the examples): WIN32;_CRT_SECURE_NO_WARNINGS;_WINDOWS;ADD_;MAGMA_NOAFFINITY;HAVE_CUBLAS;MIN_CUDA_ARCH=200;

That was quite an effort!
However with these changes and updates everything worked very well (all libraries, tests, and also my own application … and for large matrices it is really a benefit going for 64bit).


Regards Arno
Fractarno
 
Posts: 5
Joined: Sun Nov 06, 2016 9:25 am

Re: trying to build magma-2.1.0 on Windows

Postby Manuel__ » Sat Feb 25, 2017 12:03 am

Hello
I am also trying to build magma in windows, without success so far.

I wonder, would it be possible for me to obtain the magma.lib and magma-sparse.lib files that you have managed to create?

They are too big to pass as email attachments, but maybe through ftp ? I am sure other people would be interested as well.

Many thanks in advance
Manuel
Manuel__
 
Posts: 10
Joined: Fri Feb 24, 2017 11:48 pm

Re: trying to build magma-2.1.0 on Windows

Postby mgates3 » Sun Feb 26, 2017 6:59 pm

Were there particular problems that you encountered in building MAGMA, using the directions in README-Windows?
-mark
mgates3
 
Posts: 750
Joined: Fri Jan 06, 2012 2:13 pm

Next

Return to User discussion

Who is online

Users browsing this forum: Bing [Bot] and 5 guests

cron