Code Monkey home page Code Monkey logo

jlblancoc / suitesparse-metis-for-windows Goto Github PK

View Code? Open in Web Editor NEW
438.0 438.0 217.0 97.18 MB

CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

License: BSD 3-Clause "New" or "Revised" License

C 82.85% Python 0.05% C++ 4.51% CMake 1.09% Makefile 0.42% Fortran 0.30% TeX 2.99% MATLAB 6.34% Shell 0.11% Awk 0.01% Cuda 0.38% Java 0.45% HTML 0.37% Ruby 0.09% Batchfile 0.01% sed 0.01% M4 0.02% Jupyter Notebook 0.02% Dockerfile 0.01% Assembly 0.02%
c-plus-plus cmake suitesparse

suitesparse-metis-for-windows's Introduction

Build Status build-with-cmake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake. The project includes precompiled BLAS/LAPACK DLLs for easy use with Visual C++. Licensed under BSD 3-Clause License.

The goal is using one single CMake code to build against SuiteSparse in standard Linux package systems (e.g. libsuitesparse-dev) and in manual compilations under Windows.

Credits: Jose Luis Blanco (Universidad de Almeria); Jerome Esnault (INRIA); @NeroBurner

logo

1. Instructions

  • (1) Install CMake.

  • (2) Only for Linux/Mac: Install LAPACK & BLAS. In Debian/Ubuntu: sudo apt-get install liblapack-dev libblas-dev

  • (3) Clone or download this project (latest release) and extract it somewhere in your disk, say SP_ROOT.

    • (OPTIONAL) CMake will download SuiteSparse sources automatically for you (skip to step 4), but you may do it manually if preferred:
      • Populate the directories within SP_ROOT with the original sources from each project:
        • SuiteSparse:
          • Download SuiteSparse-X.Y.Z.tar.gz from Tim Davis' webpage.
          • Extract it.
          • Merge (e.g. copy and paste from Windows Explorer) the tree SuiteSparse/* into SP_ROOT/SuiteSparse/*.
          • Make sure of looking for patches in the original webpage and apply them to prevent build errors.
        • METIS: (Optional, only if need METIS for partitioning)
          • Download metis-X.Y.Z.tar.gz.
          • Extract it.
          • Merge the tree metis-X.Y.Z/* into SP_ROOT/metis/*.
          • Add the command cmake_policy(SET CMP0022 NEW) right after the line project(METIS) in metis/CMakeLists.txt.
  • (4) Run CMake (cmake-gui), then:

    • Set the "Source code" directory to SP_ROOT
    • Set the "Build" directory to any empty directory, typically SP_ROOT/build
    • Press "Configure", change anything (if needed)
    • Important: I recommend setting the CMAKE_INSTALL_PREFIX to some other directory different than "Program Files" or "/usr/local" so the INSTALL command does not require Admin privileges. By default it will point to SP_ROOT/build/install.
    • If you have an error like: "Cannot find source file: GKlib/conf/check_thread_storage.c", then manually adjust GKLIB_PATH to the correct path SP_ROOT/metis/GKlib.
    • HAVE_COMPLEX is OFF by default to avoid errors related to complex numbers in some compilers.
    • Press "Generate".
  • (5) Compile and install:

    • In Visual Studio, open SuiteSparseProject.sln and build the INSTALL project in Debug and Release. You may get hundreds of warnings, but it's ok.
    • In Unix: Just execute make install or sudo make install if you did set the install prefix to /usr/*
  • (6) Notice that a file SuiteSparseConfig.cmake should be located in your install directory. It will be required for your programs to correctly build and link against SuiteSparse.

  • (7) Only for Windows: You will have to append CMAKE_INSTALL_PREFIX\lib*\lapack_blas_windows\ and CMAKE_INSTALL_PREFIX\lib* to the environment variable PATH before executing any program, for Windows to localize the required BLAS/Fortran libraries (.DLLs).

1.2 Using OpenBLAS as alternative to generic BLAS/LAPACK

Starting with v0.3.21 OpenBLAS ships with an f2c-converted copy of LAPACK v3.9.0 which is used if no fortran compiler is available. This means we can compile OpenBLAS to provide BLAS and LAPACK functionality with a regular C++ compiler like MSVC or GCC. This includes compiling everything as a static library. If that library is later used to compile an executable the executable can run without any external dependencies (like fortran runtimes or lapack dlls in the generic fortran based BLAS and LAPACK implementation).

When building OpenBLAS yourself be sure to use BUILD_WITHOUT_LAPACK=NO and NOFORTAN=1 when configuring OpenBLAS with CMake to get a pure C++ OpenBLAS library (with the benefits described above).

To tell SuiteSparse to build against this OpenBLAS implementation set the option WITH_OPENBLAS=ON.

2. Test program

Example CMake programs are provided for testing, based on Tim Davis' code in his manual:

An example to test CUDA support can be found here.

3. Integration in your code (unique code for Windows/Linux)

  • Add a block like this to your CMake code (see complete example), and set the CMake variable SuiteSparse_DIR to SP_INSTALL_DIR/lib/cmake/suitesparse-5.4.0/ or the equivalent place where SuiteSparse-config.cmake was installed.

    # ------------------------------------------------------------------
    # Detect SuiteSparse libraries:
    # If not found automatically, set SuiteSparse_DIR in CMake to the
    # directory where SuiteSparse-config.cmake was installed.
    # ------------------------------------------------------------------
    find_package(SuiteSparse CONFIG REQUIRED)
    target_link_libraries(MY_PROGRAM PRIVATE ${SuiteSparse_LIBRARIES})
    
    # or directly add only the libs you need:
    target_link_libraries(MY_PROGRAM PRIVATE
      	SuiteSparse::suitesparseconfig
      	SuiteSparse::amd
      	SuiteSparse::btf
      	SuiteSparse::camd
      	SuiteSparse::ccolamd
      	SuiteSparse::colamd
      	SuiteSparse::cholmod
      	SuiteSparse::cxsparse
      	SuiteSparse::klu
      	SuiteSparse::ldl
      	SuiteSparse::umfpack
      	SuiteSparse::spqr
      	SuiteSparse::metis
      )
    
  • In Windows, if you have a CMake error like:

    Could not find a package configuration file provided by "LAPACK" with any
     of the following names:
    
       LAPACKConfig.cmake
       lapack-config.cmake
    

    set the CMake variable LAPACK_DIR to SP_ROOT/lapack_windows/x64/ (or x32 for 32bit builds).

4. Why did you create this project?

Porting SuiteSparse to CMake wasn't trivial because this package makes extensive usage of a one-source-multiple-objects philosophy by compiling the same sources with different compiler flags, and this ain't directly possible to CMake's design.

My workaround to this limitation includes auxiliary Python scripts and dummy source files, so the whole thing became large enough to be worth publishing online so many others may benefit.

suitesparse-metis-for-windows's People

Contributors

andr3wmac avatar awf avatar dtmoodie avatar enricodetoma avatar jlblancoc avatar kinddragon avatar neroburner avatar nightlark avatar orlandini avatar riegl-gc avatar saedrna avatar simbaforrest avatar xoviat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

suitesparse-metis-for-windows's Issues

Error running cholmod_demo.c

Hi, I'm trying to use your library and was testing the cholmod_demo.c but we ran into an issue.
When trying to compile the file in VS, the IDE signaled
Bx = B->x; *Impossible to assign a type void * to a type double. **

Any idea why?

P.S. We did import all the headers and libs as in your example, the IDE finds all the references, so that's not the problem I think.

Thanks.

Is SuiteSparse 64 bit compatible?

Hi, I managed to make a program that works using CSparse lib. It works as long as I tell VS to compile it as 32 bit, but since the matrices I'll have to work with in the final version are WAY bigger, I'll need to use a 64 bit version. Here comes the problem.
When I tell VS to compile as 64 bit, it gives me these 2 errors:
1>matrix-math.obj : error LNK2001: external symbol cs_lsolve unresolved
1>matrix-math.obj : error LNK2001: external symbol cs_load unresolved

Is SuiteSparse 64 bit compatible? If so, is there a way to "make it" 64 bit?

Cannot find source file: GKlib/conf/check_thread_storage.c

From the README:

Apparently only for Linux: if you have an error like: "Cannot find source file: GKlib/conf/check_thread_storage.c", then manually adjust GKLIB_PATH to the correct path SP_ROOT/metis/GKlib.

I also got this error on Windows. Manually adjusting GKLIB_PATH solved it. Maybe you could change this part in the README, as I didn't read it becaus of the "only for Linux" part and so it took some time to find the error.

errors

Hi,
Compiling this project in Visual Studio 2015, I got an error message:
3>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\math.h(520): error C2059: syntax error: (
In math.h(520) I see:
Check_return _ACRTIMP double __cdecl rint(In double _X);
What should I fix? I try to use suitesparse-metis-for-windows for ceres-solver

Problem of build on VS 2013

I downloaded suitesparse from https://github.com/jlblancoc/suitesparse-metis-for-windows/archive/v1.3.1.zip, then unpacked it, and under the instructions to build it.
But I have some errors to complete the build process, as shown beolow:

========== Build: 14 succeeded, 7 failed, 0 up-to-date, 1 skipped ==========

some of the detailed errors

Error 2 error C2059: syntax error : '(' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h 515 1 metis
Error 348 error C2059: syntax error : '(' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h 515 1 metis
Error 367 error C2059: syntax error : '(' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h 515 1 metis
....

I do not know what's wrong about it.

Make metis respect LIB_POSTFIX

In metis/libmetis/CMakeLists.txt, there is an install command which doesn't respect LIB_POSTFIX:

                                install(TARGETS metis ## this line is also the string pattern to check if the modification had already done^M
                                                EXPORT  SuiteSparse^M
                                                RUNTIME DESTINATION bin^M
                                                LIBRARY DESTINATION lib64^M
                                                ARCHIVE DESTINATION lib64^M
                                                PUBLIC_HEADER DESTINATION include^M

Strange behavior when CMaking on Windows 7

Great work, really appreciated!

I have some experiences to share on the make process.

I use Visual Studio 15 vsn 17 on Windows 7 64-bit + Latest CMake + sources for SuiteSparse also from here.

  1. libamd.lib is created in the wrong place. It should be <SP_ROOT>\build\lib\Release\ , but it has the default VS location. The other projects are ok.
  2. All projects are generated for win32, i.e. they add /MACHINE:X86 to AdditionalOptions. I had to reset this by hand for all projects, but it comes back sometimes (sorry, don't know what I did to cause it).
  3. VS 15, vsn 17 has rint() and INFINITY. The former causes many errors, the latter only lots of annoying warnings. This may be my fault as I'm not sure I properly added "cmake_policy(SET CMP0022 NEW)".
  4. SuiteSparse/CHOLMOD/MATLAB/ldlrowmod.c is missing (seen when compiling the MATLAB files). I copied the Googled file from a related project.

-marcel

A problem when build suitesparse-metis-for-windows with CUDA

Hi everyone, I use CMake to generate .sln file, I use visual studio 2015, 64 bit machine, when I do not select WITH_CUDA in configure, the generate sln file can build successfully, it works all OK, but when I select WITH_CUDA, and these are some of the settings in CMake:
CUDA_HOST_COMPILER: $(VCInstallDir)bin
CUDA_SDK_ROOT_DIR: CUDA_SDK_ROOT_DIR-NOTFOUND
CUDA_TOOLKIT_ROOT_DIR: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
CUDA_USE_STATIC_CUDA_RUNTIME: YES
I have installed CUDA 8.0 and test CUDA successfully. When I build the SuiteSparseProject.sln, some of errors have occurred:
Error C2821; first formal parameter to 'operator new' must be 'size_t'; GPUQREngine; d:\project\suitesparse\suitesparse-metis-for-windows\suitesparse\gpuqrengine\include\GPUQREngine_Front.hpp, Line50
the code is:
void* operator new(long unsigned int reqMem, Front* ptr){ return ptr; }
how can I fix it? thanks very much!

looking for latest cmake to suiteSparse for windows

Hi
I am using version 1.3.1 to build the cholmode GPU environment, however ,as mentioned, there is no implementation of cholmode_l_solve() functions. Even-though the GPU libraries are generated.
From the discussion I understand that some modifications has to be made.
Do you have a package that includes these modifications?

problem on windows visual studio 2013 express

I followed your guide and created a project for msvs 2013. However, compiling gives an error in the cxsparse project.

error C2143: syntax error : missing ';' before '*

in cs.h for project cxsparse

Is this simply a suitesparse problem or someway related to the package? Anyone else has similar issues? I use version 4.2.1

Cheers

suitesparse testing-read a sparse matrix,how?

in example-projects -> cholmod -> cholmod-test.c line 15
//code
A = cholmod_read_sparse (stdin, &c) ; /* read in a matrix */
//code
how do we input the matrix when it comes to this line in debugging?
what is the acceptable form of a matrix typed through CMD ? or this is only done by file reading in C++? for example reading an matrix market file ?
thanks

Unresolved external: METIS

Hi,
Compilation with Metis goes ok but when I compile the cholmod example it says

libcholmod.lib(cholmod_metis.o.obj) : error LNK2019: unresolved external symbol _METIS_NodeComputeSeparator referenced in function _cholmod_metis_bisector

I'm using SuiteSparse 4.4.3 and I've tried Metis 5.0 and 5.1.

Visual Studio 2015 Math.h Error

In a throw back to issue 6, Visual Studio 2015 does define "rint" and "INFINITY", and so there's a syntax error reported in math.h - the fix from Issue 6 defines "rint" for MSC compilers. (It's "rint" that's a problem; the redefinition of INFINITY just causes some warnings).

The fix is to test for a version before 1900 (which is VS2015) as below:

#ifdef __MSC__
/* MSC may not have rint() function */
#if(_MSC_VER < 1900)
#define rint(x) ((int)((x)+0.5))  
#endif

/* MSC does not have INFINITY defined */
#ifndef INFINITY
#if(_MSC_VER < 1900)
#define INFINITY FLT_MAX
#endif
#endif
#endif

I don't speak Git so if someone else could confirm I'm right and make the change that would save others from traversing this path!

Getting WITH_CUDA to work with MSVC 2015/2017

I'm trying tho get the WITH_CUDA option working on master. Firstly I needed to apply the fixes mentioned in the previous efforts #17 #33 #45.

That gives me the following patch of trivial changes:

Expand

diff --git a/SuiteSparse/CHOLMOD/GPU/t_cholmod_gpu.c b/SuiteSparse/CHOLMOD/GPU/t_cholmod_gpu.c
index c1b016f..dd3c949 100644
--- a/SuiteSparse/CHOLMOD/GPU/t_cholmod_gpu.c
+++ b/SuiteSparse/CHOLMOD/GPU/t_cholmod_gpu.c
@@ -25,7 +25,9 @@
 #define L_ENTRY 2
 #endif
 
-
+#ifdef _MSC_VER
+typedef int (*__compar_fn_t) (const void *, const void *);
+#endif
 /* ========================================================================== */
 /* === gpu_clear_memory ===================================================== */
 /* ========================================================================== */
@@ -112,13 +114,13 @@ int TEMPLATE2 (CHOLMOD (gpu_init))
 
     /* divvy up the memory in dev_mempool */
     gpu_p->d_Lx[0] = Common->dev_mempool;
-    gpu_p->d_Lx[1] = Common->dev_mempool + Common->devBuffSize;
-    gpu_p->d_C = Common->dev_mempool + 2*Common->devBuffSize;
-    gpu_p->d_A[0] = Common->dev_mempool + 3*Common->devBuffSize;
-    gpu_p->d_A[1] = Common->dev_mempool + 4*Common->devBuffSize;
-    gpu_p->d_Ls = Common->dev_mempool + 5*Common->devBuffSize;
-    gpu_p->d_Map = gpu_p->d_Ls + (nls+1)*sizeof(Int) ;
-    gpu_p->d_RelativeMap = gpu_p->d_Map + (n+1)*sizeof(Int) ;
+    gpu_p->d_Lx[1] = (char *)Common->dev_mempool + Common->devBuffSize;
+    gpu_p->d_C = (char *)Common->dev_mempool + 2*Common->devBuffSize;
+    gpu_p->d_A[0] = (char *)Common->dev_mempool + 3*Common->devBuffSize;
+    gpu_p->d_A[1] = (char *)Common->dev_mempool + 4*Common->devBuffSize;
+    gpu_p->d_Ls = (char *)Common->dev_mempool + 5*Common->devBuffSize;
+    gpu_p->d_Map = (char *)gpu_p->d_Ls + (nls+1)*sizeof(Int) ;
+    gpu_p->d_RelativeMap = (char *)gpu_p->d_Map + (n+1)*sizeof(Int) ;
 
     /* Copy all of the Ls and Lpi data to the device.  If any supernodes are
      * to be computed on the device then this will be needed, so might as
diff --git a/SuiteSparse/CMakeLists.txt b/SuiteSparse/CMakeLists.txt
index a4c99eb..c8b7554 100644
--- a/SuiteSparse/CMakeLists.txt
+++ b/SuiteSparse/CMakeLists.txt
@@ -35,7 +35,8 @@ include_directories(".")  # Needed for "SourceWrappers/*.c" files
 set(suitesparseconfig_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/SuiteSparse_config) # Needed by all subprojects
 
 set(SUBPROJECTS_TO_ADD 
-	SuiteSparse_config
+	SuiteSparse_GPURuntime
+	GPUQREngine	
 	AMD
 	BTF
 	CAMD
@@ -47,17 +48,10 @@ set(SUBPROJECTS_TO_ADD
 	LDL
 	UMFPACK
 	SPQR
-	CACHE STRING "list of all sub-directories to add to cmake build"
 )
 
-if(WITH_CUDA)
-	set(SUBPROJECTS_TO_ADD
-		${SUBPROJECTS_TO_ADD}
-		SuiteSparse_GPURuntime
-		GPUQREngine	
-		)
-endif()
 
+message("SUBPROJECTS_TO_ADD: ${SUBPROJECTS_TO_ADD}")
 foreach(subdir ${SUBPROJECTS_TO_ADD})
 	add_subdirectory(${subdir})
 endforeach()
diff --git a/SuiteSparse/GPUQREngine/Include/GPUQREngine_BucketList.hpp b/SuiteSparse/GPUQREngine/Include/GPUQREngine_BucketList.hpp
index f37e3ec..6f141a9 100644
--- a/SuiteSparse/GPUQREngine/Include/GPUQREngine_BucketList.hpp
+++ b/SuiteSparse/GPUQREngine/Include/GPUQREngine_BucketList.hpp
@@ -62,7 +62,7 @@ public:
     int VThead;              // Index of the first available entry in VTlist
 
     // Constructors
-    void *operator new(long unsigned int, BucketList* p)
+    void *operator new(size_t, BucketList* p)
     {
         return p;
     }
diff --git a/SuiteSparse/GPUQREngine/Include/GPUQREngine_Front.hpp b/SuiteSparse/GPUQREngine/Include/GPUQREngine_Front.hpp
index 02d4208..8517b2c 100644
--- a/SuiteSparse/GPUQREngine/Include/GPUQREngine_Front.hpp
+++ b/SuiteSparse/GPUQREngine/Include/GPUQREngine_Front.hpp
@@ -47,7 +47,7 @@ public:
     /* Debug Fields */
     bool printMe;
 
-    void* operator new(long unsigned int reqMem, Front* ptr){ return ptr; }
+    void* operator new(size_t reqMem, Front* ptr){ return ptr; }
 
     Front(
         Int fids_arg,                   // the front identifier
diff --git a/SuiteSparse/GPUQREngine/Include/GPUQREngine_LLBundle.hpp b/SuiteSparse/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
index 93bd321..fc34714 100644
--- a/SuiteSparse/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
+++ b/SuiteSparse/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
@@ -68,7 +68,7 @@ public:
 
     TaskType CurrentTask;
 
-    void *operator new(long unsigned int, LLBundle* p){ return p; }
+    void *operator new(size_t, LLBundle* p){ return p; }
     LLBundle(BucketList *buckets, Int panelSize, Int nativeBucket);
 
     // empty LLBundle constructor (currently used, kept for possible future use
diff --git a/SuiteSparse/GPUQREngine/Include/GPUQREngine_Scheduler.hpp b/SuiteSparse/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
index aa3781d..069b01a 100644
--- a/SuiteSparse/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
+++ b/SuiteSparse/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
@@ -90,7 +90,7 @@ public:
     cudaStream_t memoryStreamD2H;
 
     /* Scheduler.cpp */
-    void *operator new(long unsigned int, Scheduler* p){ return p; }
+    void *operator new(size_t, Scheduler* p){ return p; }
     Scheduler(Front *fronts, Int numFronts, size_t gpuMemorySize);
     ~Scheduler();
 
diff --git a/metis/GKlib/gk_arch.h b/metis/GKlib/gk_arch.h
index 4cc1d5a..221d0d4 100644
--- a/metis/GKlib/gk_arch.h
+++ b/metis/GKlib/gk_arch.h
@@ -65,9 +65,11 @@ typedef ptrdiff_t ssize_t;
 #ifdef __MSC__
 
 /* MSC does not have INFINITY defined */
+#if(_MSC_VER < 1900)
 #ifndef INFINITY
 #define INFINITY FLT_MAX
 #endif
 #endif
+#endif
 
 #endif

I still can't compile spqr, though. I end up with a lot of the following:

cuda\v9.2\include\cuda_fp16.h(124): error C2526: '__float2half': C linkage function cannot return C++ class '__half'
cuda\v9.2\include\cuda_fp16.hpp(363): warning C4190: '__float2half' has C-linkage specified, but returns UDT '__half' which is incompatible with C
cuda\v9.2\include\cuda_fp16.hpp(147): note: see declaration of '__half'
cuda\v9.2\include\cuda_fp16.hpp(362): error C2371: '__float2half': redefinition; different basic types
cuda\v9.2\include\cuda_fp16.h(124): note: see declaration of '__float2half'

It seems to arise from an unsavoury mixture of C/C++ code, but I don't know how to fix it. Does anybody have an idea what is going on?

I attach the full build log compiled with /showincludes.

build.log

Unknown CMake command "install_suitesparse_project".

Please help me(following is the codes in CMakeLists.txt)
PROJECT(suitesparseconfig)

include_directories("${suitesparseconfig_SOURCE_DIR}")

ADD_LIBRARY(suitesparseconfig STATIC
SuiteSparse_config.c
SuiteSparse_config.h
)

install_suitesparse_project(suitesparseconfig "SuiteSparse_config.h")

WITH_CUDA Enable on VS 2013, Windows 10 64bit

Same problem with VS 2013, Windows 10 64bit
Enabling WITH_CUDA option produces :
"GPUQREngine.hpp" cannot be opened for compiling SPQR.
And some "unknown size" errors in t_cholmod_gpu.c

Windows shared build failed

Hello,
I use Windows 7 64 bits with Visual studio 2012.

I tried to compile suitesparse under windows with SHARED=ON.
The build failed because lib/suitesparse_config.lib was not found.
cmake clearly wants to build the shared libs, but it's still looking for statically linked libraries.

Best regards,

YC

cmake error

Hi, I am building SuiteSparse followed your Instruction in Windows 7 X64. But I encountered some errors when I run cmake:
Looking for execinfo.h -- not found
Looking for complex.h -- not found

And also, I haven't found the patches you said in Instruction "Make sure of looking for patches in the original webpage and apply them to prevent build errors."


Looking forward to your help.

Providing LAPACK lib on windows

It would be nice, if you could provide a LAPACK lib via a cmake option on windows. So that this lib would be used instead of the supplied ones.
Alternatively a bool could be introduced that makes the script act the same on windows and unix systems. I.e. CMakeLists.txt would expect a findLAPACK and findBLAS cmake script somewhere.

To build CHOLMOD 3.0.0 using CMake

Hi,
My name is Kevin. Thanks for CMake version. I notice that your CMake version does not involve GPU module in lastest CHOLMOD release.

In lastest CHOLMOD release, four files are added to $(CHOLMOD)\GPU, a cuda source file "cholmod_gpu_kernels.cu", a c source file, "cholmod_gpu.c", a dummy file "cholmod_gpu_kernels.c", and a template file "t_cholmod_gpu.c".

I follow your style, adding "cholmod_gpu.o.c" and "cholmod_l_gpu.o.c" to "SourceWrappers" folder, and expand contents in each source wrapper. I build "cholmod_gpu_kernels.cu" in a separate visual studio project, generating "cholmod_gpu_kernels.lib" static library. Then I link this library to cmake-generated cholmod project. I add "GPU_BLAS" to preprocessor.

There are some problems in Tim's source code of "t_cholmod_gpu.c". In line 94, "feenableexcept()" function is referenced from header "fenv.h", but that function is not available in visual studio. In line 117 - 124, pointers "Common->dev_mempool", "gpu_p->d_Ls", and "gpu_p->d_Map" are the type of "void_", they have to be converted to "unsigned char_" before shifted by offset. In line 274, compare function "__compar_fn_t" is not declared. I declared it by "typedef int (* compar_fn_t) (const void, const void)".

After these modification, I build cholmod project. generating "libcholmod.lib". Then I try demo "cholmod_l_demo.c". I comment "cholmod_l_version()" function in line 135, since that is a dummy function, and add "cm->useGPU=1" right under line 101 "cholmod_l_start(cm);".I add "GPU_BLAS" to preprocessor, then link demo project to "cudart_static.lib", "cublas.lib", and "cholmod_gpu_kernels.lib", "liblapack.lib", "libblas.lib". Then I build this project and run it. But from printed results, gpu functions are not called.

Can you give a try to this new version of CHOLMOD? Thank you!

Error on vs2015

Hi, @jlblancoc when I followed by these steps, and then there are 7 errors all about D8012. Can you please help me to look at it?
default

Errors when compile with WITH_CUDA option

I got some errors when compile suitesparse with WITH_CUDA option enabled. "GPUQREngine.hpp" cannot be opened for compiling SPQR. And some "unknown size" errors in t_cholmod_gpu.c.

I use the lastest package 1.3.0 with VS 2013, Windows 10 64bit

Question about installation

Hello.
When installing SuiteSparse, I have encountered a problems - Cmake has a problem finding CUDA, BLAS and LAPACK (after checking all the checkboxes except the HAVE_COMPLEX).
I need the SuiteSparse Pack to use the UmfPackLU sparse matrix least square problem solver in the Eigen libray.
In point No. (4) in the installation guide - what Entries do I need to check to generate? For example I Don't think CUDA is necessary for my project, but i am not sure whether I could uncheck it, as it may be necessary for the SuiteSparse installation.
Thank you very much for your help.

Changing the option `SUITESPARSE_INSTALL_PREFIX` has no effect when using `cmake-gui`

I'd like to install suitesparse into a custom location. This is supported with SUITESPARSE_INSTALL_PREFIX. While setting SUITESPARSE_INSTALL_PREFIX from the command line probably works, it's not possible to change the installation prefix when using CMake gui. The problem is the following. To be able to see (and therefore change) the option SUITESPARSE_INSTALL_PREFIX, you need to configure once. Configuring the first time will set CMAKE_INSTALL_PREFIX to the default value for SUITESPARSE_INSTALL_PREFIX. Now, if you go and change SUITESPARSE_INSTALL_PREFIX this change will not be propagated to CMAKE_INSTALL_PREFIX because CMAKE_INSTALL_PREFIX is already initialized to a non-default value, therefore the if clause [1] is false and CMAKE_INSTALL_PREFIX is not updated as proposed.

A fix would probably look something like

IF(WIN32 AND (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR CMAKE_INSTALL_PREFIX != SUITESPARSE_INSTALL_PREFIX))

where I'm usure about how to compare the value of two variables in CMake.

[1] https://github.com/jlblancoc/suitesparse-metis-for-windows/blob/master/CMakeLists.txt#L18

SuiteSparse_FOUND heads up for Ceres

IF you're following this route to try and get Ceres built under VS2013, if you follow the instructions here and drop the suggested (and included here) FindSuiteSparse.cmake file into the ceres-solver-1.11.0/cmake folder you'll find that, despite everything being located, Ceres' cmake still thinks finding SuiteSparse has failed. This is easily resolved! CMake variables are case-sensitive - the variable that gets set here is SuiteSparse_FOUND, but the one Ceres' CMakeLists.txt is looking for is SUITESPARSE_FOUND. Change one or the other and all will be well.

error about CSParse--cs_multiply

hi,
I am using the suitesparse, and it is very good. But I found one error in cs_multiply. For sparse matrix *sparse matrix, I found that the value of computing result in fourth column is wrong.
So you can test two matrix, and find if there is problem

Input Error: Incorrect objective type when use cholmod?

When I use cholmod, there is "Input Error: Incorrect objective type when use cholmod" In following code lines of "option.c" :

case METIS_OP_OMETIS:
if (ctrl->objtype != METIS_OBJTYPE_NODE) {
IFSET(dbglvl, METIS_DBG_INFO, printf("Input Error: Incorrect objective type.\n"));
return 0;
}

What's the problem?

Thanks

how to generate dll's for suitesparse

I just built SuiteSparseProject according to your instructions and built the INSTALL project in VS2015.
What I need now is a dll for umfpack. Should this already have been generated? (No dll's have been generated in either the SP_Root or build dirs).
Or which steps will generate it? Thanks.

problem build in x64 version

hi,

I can build the solution in x64 platform,but when I used the 64bit version *.lib, there's link error:

libcholmodd.lib(cholmod_super_numeric.o.obj) : error LNK2019: unresolved external symbol dtrsm_, referenced in function "r_cholmod_super_numeric". And there are in total 13 such link errors, I think that it may be caused by lapack_windows problem. is the lapack_windows 32bit? if so, can you add the 64bit lapack_windows to the project?
Thank you very much.

TYL

metis error:Input Error: Incorrect objective type.

Hi, When I run the program with CUDA, print
Runtime parameters:
Objective type: METIS_OBJTYPE_VOL
Coarsening type: METIS_CTYPE_RM
Initial partitioning type: METIS_IPTYPE_GROW
Refinement type: Unknown!
Perform a 2-hop matching: Yes
Number of balancing constraints: 1
Number of refinement iterations: 13752768
Random number seed: 55995168
Number of separators: 13756416
Compress graph prior to ordering: Yes
Detect & order connected components separately: Yes
Prunning factor for high degree vertices: 0.300000
Allowed maximum load imbalance: 13753.480

Input Error: Incorrect objective type.
nbrpool statistics
nbrpoolsize: zu nbrpoolcpos: zu
nbrpoolreallocs: zu

and I found that did not use cuda to accelerate, but the result is right. What's wrong? The environment is win10 X64 cuda8.0. Thank you!

compile error

@jlblancoc
Hi, jlblancoc,
I encountered some errors when I compile the example in SP_ROOT/example-projects/cholmod/ under Windows 64bits with VisualStdio 2013.
It shows that
error LNK2019: unresolved external symbol _cholmod_start, referenced in function _main
error LNK2019: unresolved external symbol _cholmod_finish, referenced in function _main
....etc.
Generally speaking, such errors mean that I haven't add the appropriate libs and include files. But in my project, I do add them.
So, I am really confused about it.
Can you send me a off-the-shelf version?

mUMFPACK module Fortran

Hi,

I am new to VS and Fortran and I would appreciate if you could help me...

I followed all the steps and was able to build the INSTALL project on VS15.
Now, what I would like is to use the mUMFPACK module for Fortran. What I did was

  1. On the build/SuiteSparse/SuiteSparse.sln I added a project MAIN with 2 files: main.f90 which calls the module umfpack.f90 and the module itself.
  2. On the umfpack.f90 file I add the command INCLUDE 'umfpack.h'.
  3. Right-click the executable Fortran MAIN project and select Dependencies to set the executable project as dependent on the umfpack project

When I try to build it, though, I get the following error. Are the steps correct? What am I missing?

Compiling with Intel(R) Visual Fortran Compiler 17.0.0.109 [IA-32]...
ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug" /object:"Debug" /Fd"Debug\vc140.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" /Qm32 "C:\Users\falves\Dropbox\Repo\hank-main\umfpack.f90"
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(1): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/* ========================================================================== /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(2): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
=== umfpack.h ============================================================ /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(3): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
========================================================================== /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(5): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
-------------------------------------------------------------------------- /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(6): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com. /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(7): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
All Rights Reserved. See ../Doc/License for License. /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(7): error #5082: Syntax error, found IDENTIFIER 'RESERVED' when expecting one of: => = / , [ ( * ;
/
All Rights Reserved. See ../Doc/License for License. /
--------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(7): error #5082: Syntax error, found '.' when expecting one of: [
/
All Rights Reserved. See ../Doc/License for License. /
------------------------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(8): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
-------------------------------------------------------------------------- /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(10): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/

^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(11): error #5082: Syntax error, found IDENTIFIER 'IS' when expecting one of: => = . [ % ( :
This is the umfpack.h include file, and should be included in all user code
---------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(12): error #5082: Syntax error, found IDENTIFIER 'USES' when expecting one of: => = . [ % ( :
that uses UMFPACK. Do not include any of the umf_* header files in user
---------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(12): error #5082: Syntax error, found IDENTIFIER 'NOT' when expecting one of: .EQV. .NEQV. .XOR. .OR. .AND. .LT. < .LE. <= .EQ. == .NE. /= .GT. > ...
that uses UMFPACK. Do not include any of the umf_* header files in user
---------------------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(13): error #5144: Invalid character_kind_parameter. No underscore
code. All routines in UMFPACK starting with "umfpack_" are user-callable.
-----------------------------------------------------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(13): error #5082: Syntax error, found IDENTIFIER 'ROUTINES' when expecting one of: => = / . , [ % ( ; : )
code. All routines in UMFPACK starting with "umfpack_" are user-callable.
---------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(14): error #5144: Invalid character_kind_parameter. No underscore
All other routines are prefixed "umf_XY_", (where X is d or z, and Y is
---------------------------------------------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(14): error #5082: Syntax error, found 'ALL' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
All other routines are prefixed "umf_XY_", (where X is d or z, and Y is
----^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(15): error #5276: Unbalanced parentheses
i or l) and are not user-callable.
----------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(15): error #5082: Syntax error, found IDENTIFIER 'OR' when expecting one of: => = . [ % ( :
i or l) and are not user-callable.
------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(18): warning #5117: Bad # preprocessor line

ifndef UMFPACK_H

-^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(19): warning #5117: Bad # preprocessor line

define UMFPACK_H

-^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(16): error #5082: Syntax error, found '' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
*/
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(21): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
-------------------------------------------------------------------------- /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(22): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
Make it easy for C++ programs to include UMFPACK /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(22): error #5082: Syntax error, found IDENTIFIER 'EASY' when expecting one of: => = / , [ ( * ;
/
Make it easy for C++ programs to include UMFPACK */
-----------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(25): warning #5117: Bad # preprocessor line

ifdef __cplusplus

-^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(23): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/* -------------------------------------------------------------------------- */
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(26): error #5144: Invalid character_kind_parameter. No underscore
extern "C" {
----------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(27): warning #5117: Bad # preprocessor line

endif

-^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(29): warning #5117: Bad # preprocessor line

include "SuiteSparse_config.h"

-^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(26): error #5078: Unrecognized token '{' skipped
extern "C" {
-----------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(26): error #5082: Syntax error, found CHARACTER_CONSTANT 'C' when expecting one of: => = . [ % ( :
extern "C" {
-------^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(31): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/* -------------------------------------------------------------------------- /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(32): error #5082: Syntax error, found '/' when expecting one of: ; TYPE INTEGER REAL COMPLEX BYTE CHARACTER CLASS DOUBLE ...
/
size of Info and Control arrays /
^
C:\SP_ROOT\build\install\include\suitesparse\umfpack.h(32): error #5082: Syntax error, found IDENTIFIER 'INFO' when expecting one of: => = / , [ ( * ;
/
size of Info and Control arrays */
-----------^
C:\Users\falves\Dropbox\Repo\hank-main\umfpack.f90(46): catastrophic error: Too many errors, exiting
compilation aborted for C:\Users\falves\Dropbox\Repo\hank-main\umfpack.f90 (code 1)

ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug" /object:"Debug" /Fd"Debug\vc140.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin" /Qm32 "C:\Users\falves\Documents\Visual Studio 2015\Projects\SuiteSparse_test\main.f90"

Could NOT find BLAS

Here is the error message:
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Could NOT find BLAS (missing: BLAS_LIBRARIES)
LAPACK requires BLAS
A library with LAPACK API not found. Please specify library location.
Configuring done

I have set the path to the folder which contains these:
image

but still has this issue.

Error to build example project if enable BUILD_METIS

Hi Jose Luis Blanco,

First of all, thanks for creating this project!

When I build the project with BUILD_METIS on, everything builds fine. However if I build the example project "cholmod", a linking error shows "METIS_NodeComputeSeparator" cannot be found in any .lib file (I checked that all lib files were correctly linked). I believe this might be due to the reason that the METIS 5.1.0 do not have this function anymore. Maybe we should switch back to METIS 4?

Best,
Chen

SuiteSparse version 4.4.3 does not work with latest metis

When using the SUITESPARSE_DL_LAST flag to download the latest library versions, the metis lib seems to be updated but suitesparse is fixed to version 4.4.3.
This gives a problem when linking against cholmod, since cholmod of suitesparse 4.4.3 is not compatible with latest metis (the interface of metis changed slightly)

For the current suitesparse version 4.5.1 it is claimed that it works well with the current metis (and in my test there were no problems when linking). Thus, the fixed version should be corrected to 4.5.1 or at least a comment added in the cmake-file.

cmake error

Hi, I am building SuiteSparse followed your Instruction in Windows 7 X64. But I encountered some errors when I run cmake:
Looking for execinfo.h -- not found
Looking for complex.h -- not found

And also, I haven't found the patches you said in Instruction "Make sure of looking for patches in the original webpage and apply them to prevent build errors."


Looking forward to your help.

Update SuiteSparse url

Plz update SUITESPARSE_URL to http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.5.6.tar.gz in checkGetSuiteSparse.cmake for the latest SuiteSparse library.

Export NCOMPLEX

(TO DO)
When NCOMPLEX is defined building SP, we must also export that flag to the user code.

Probably thru SP-config.cmake.

Licence

Hi,
what is the licence for the FindCMake scripts?
Can this file be included into an open source project under the licence GPL2 with runtime exception?

Regards,
Marco.

Errors with Metis

I tried to compile SuiteSparse+Metis again and got a bunch of new errors (I've never seen them before)

error C2059: syntax error : '(' C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h 515

I spent hours to find out how to fix them: need to remove from "metis/GKlib/gk_arch.h"

            #ifdef __MSC__ 
            /* MSC does not have rint() function */ 
            #define rint(x) ((int)((x)+0.5)) 

            /* MSC does not have INFINITY defined */ 
            #ifndef INFINITY 
            #define INFINITY FLT_MAX 
            #endif 
            #endif 

I know these errors come from Metis, should we put a small notice of them in the front page?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.