Search code examples
windowsmakefile

How to make superlu in Windows


I have downloaded armadillo 6.5. It needs superLU(4.3) library to solve sparse matrix system of equations.

I have downloaded superlu from here but when I want to make it in Windows, it gives:

( cd SRC; make )
process_begin: CreateProcess(NULL, ( cd SRC; make ), ...) failed.
make (e=2): The system cannot find the file specified.
Makefile:36: recipe for target 'superlulib' failed
make: *** [superlulib] Error 2

If I cd to SRC directory manually and do make in there, a lot of *.o file are created but again I get this error:

ar cr /Codes/SuperLU/SuperLU_4.3/lib/libsuperlu_4.3.a \
        sgssv.o sgssvx.o ssp_blas2.o ssp_blas3.o sgscon.o slangs.o sgsequ.o slaqgs.o spivotgrowth.o sgsrfs.o sgstrf.o sgstrs.o scopy_to_ucol.o ssnode_dfs.o ssnode_bmod.o spanel_dfs.o sp
anel_bmod.o sreadhb.o sreadrb.o sreadtriple.o scolumn_dfs.o scolumn_bmod.o spivotL.o spruneL.o smemory.o sutil.o smyblas2.o sgsisx.o sgsitrf.o sldperm.o ilu_sdrop_row.o ilu_ssnode_dfs.o
 ilu_scolumn_dfs.o ilu_spanel_dfs.o ilu_scopy_to_ucol.o ilu_spivotL.o sdiagonal.o superlu_timer.o util.o memory.o get_perm_c.o mmd.o sp_coletree.o sp_preorder.o sp_ienv.o relax_snode.o
heap_relax_snode.o colamd.o ilu_relax_snode.o ilu_heap_relax_snode.o mark_relax.o mc64ad.o qselect.o lsame.o xerbla.o slacon.o  slamch.o
ar: /Codes/SuperLU/SuperLU_4.3/lib/libsuperlu_4.3.a: No such file or directory
Makefile:117: recipe for target 'single' failed
make: *** [single] Error 1

I almost have no experience with "make" and "superlu". How can I make superlu in Windows? Is there any pre-compiled superlu library available for Windows?


Solution

  • Well, it seems that makefile is written for linux systems. I could do three thing:

    1. follow the instructions on superLU FAQ page:

    This was tested in MS Visual Studio. However the configuration highly depends on which compiler you using. Normally there is an IDE (Integrated Development Environment) editor associated with your compiler. You can do it in two steps:

    Step I: Create SuperLU library file Create a new project, then include all the .c and .h files in SRC directory (they can be put in two folders of the IDE). Change the property of the project to make the output as Library file .lib (not .exe or .dll file). Compile the project to produce the library file, e.g. superlu.lib. (after you successfully compile it, you can build a release version without the debug information).

    Step II: Build your own application Create a new project with your own source files which call the SuperLU routines.Add the SRC directory and the directory where superlu.lib is located to the include path and library searching path respectively. Add superlu.lib as the link optional library. Compile your own .dll or .exe file. Then you are done.

    If you are using a compiler with command line only, you have to play with the makefile or -I -L -O -c options. As SuperLU calls BLAS routines but BLAS is not a native library of MS Visual Studio, you have to build your own BLAS library in the similar way as SuperLU library. The SuperLU distribution includes a C version of BLAS in SuperLU/CBLAS directory. This version is only functional but not fast. For speed, it's better to use vendor-supplied BLAS (e.g., Intel MKL) or public domain versions (e.g., ATLAS, or Goto BLAS).

    i could not do it right.

    1. rewrite the whole makefile for windows(i couldn't do it either because i dont know how to write a makefile)

    And finally the working solution(for me):

    1. I found a repo in github that added superLU build support for windows! you can find it here

    it has a Visual Studio(2010) solution file that builds the library and gives a lib file.