DrTimothyAldenDavis / SuiteSparse

The official SuiteSparse library: a suite of sparse matrix algorithms authored or co-authored by Tim Davis, Texas A&M University.
https://people.engr.tamu.edu/davis/suitesparse.html
Other
1.18k stars 263 forks source link

Porting the new cmake-based build system to MSVC #234

Closed Fabian188 closed 1 year ago

Fabian188 commented 1 year ago

Compiling 6.0.3 in Win10 with MSVC fails for CCOLAMD with the error

16%] Building C object CMakeFiles/ccolamd.dir/Source/ccolamd.c.obj ...\CCOLAMD\Source\ccolamd.c(1080): error C2491: "ccolamd_recommended": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1109): error C2491: "ccolamd_set_defaults": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1150): error C2491: "csymamd": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1478): error C2491: "ccolamd": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1519): error C2491: "ccolamd2": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1965): error C2491: "ccolamd_report": definition of dllimport function not allowed ...\CCOLAMD\Source\ccolamd.c(1978): error C2491: "csymamd_report": definition of dllimport function not allowed ...

Describe the bug A clear and concise description of what the bug is.

To Reproduce In a clean 6.0.3 I do the following steps after setvars to initialize Intel oneAPI cd Suitesparse_config\build cmake .. -G "NMake Makefiles" nmake

repeat for AMD and CAMD and all works for CCOLAMD I get the above error

This is the configure vor CCOLAMD

-- Building CCOLAMD version: v3.0.2 (Dec 9, 2022)
-- Source:        C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/CCOLAMD 
-- Build:         C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/CCOLAMD/build
-- The C compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Install rpath:  
-- Build   rpath: C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/CCOLAMD/build
-- Build type:    Debug
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- The Fortran compiler identification is IntelLLVM 2023.0.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Fortran: IntelLLVM
-- CUDA: not enabled
-- Found SuiteSparse_config: C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/SuiteSparse_config/build/suitesparseconfig.lib (found 
suitable version "6.0.3", minimum required is "6.0.2")
-- SuiteSparse_config version: 6.0.3
-- SuiteSparse_config include: C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/SuiteSparse_config
-- SuiteSparse_config library: C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/SuiteSparse_config/build/suitesparseconfig.lib      
-- SuiteSparse_config static:  C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/src/suitesparse/SuiteSparse_config/build/suitesparseconfig.lib      
-- Installation will be system-wide (requires 'sudo make install')
-- Skipping the demos in CCOLAMD/Demo
-- ------------------------------------------------------------------------
-- SuiteSparse CMAKE report for: ccolamd
-- ------------------------------------------------------------------------
-- install in C:/Users/fabia/code/master/release_msvc/cfsdeps/suitesparse/install: true
-- install in SuiteSparse/lib and SuiteSparse/include: false
-- build type:           Debug
-- NSTATIC:              false (build static library)
-- use OpenMP:           no
-- C compiler:           MSVC
-- C flags:              /DWIN32 /D_WINDOWS
-- C++ compiler:
-- C++ flags:
-- C Flags debug:        /Zi /Ob0 /Od /RTC1
-- C++ Flags debug:
-- compile definitions:
-- ------------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: 

I want to add, that it compiles on Windows with icx, Intel's C-Compiler from oneAPI. But probably someone was able to compile it also with MSVC.

DrTimothyAldenDavis commented 1 year ago

Might be fixed with this pull request: https://github.com/DrTimothyAldenDavis/SuiteSparse/pull/228 .

Sigh ... Windows is maddening. This dllimport / dllexport thing in Windows is so entirely non-ANSI C11.

(which is why I really appreciate the help on Windows porting!)

mmuetzel commented 1 year ago

Might be fixed with this pull request: #228 .

I hope it would. (But I'm not able to actually test it.)

This dllimport / dllexport thing in Windows is so entirely non-ANSI C11.

Unfortunately, the standard doesn't cover details about shared libraries at all afaict. Different platforms/compilers came up with different solutions for the same concept. At least, we are lucky enough that it is possible to write cross-platform/compiler compatible code with some manageable effort... 🤷‍♂️

DrTimothyAldenDavis commented 1 year ago

I'll review the pull request #228 and merge it in so you can try it.

Fabian188 commented 1 year ago

I can test with MSVC (current community edition) and icx (current Intel oneAPI 2023.0)

DrTimothyAldenDavis commented 1 year ago

This issue should be fixed with the current version on the dev or dev2 branches. I haven't tagged a beta pre-release yet. I'm polishing up a few compiler warnings that the CI is finding.

Fabian188 commented 1 year ago

I tested with dev and did cmake .. -G "NMake Makefiles" which defaults for me to MSVC 19.34.31937.0.

I built Suitesparse_config, AMD, CAMD, COLAMD, CCOLAMD, CHOLMOD (without Metis) and that worked. However it fails for UMFPACK

 50%] Linking C shared library umfpack.dll
LINK Pass 1: command "C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\umfpack.dir\objects1 /out:umfpac
k.dll /implib:umfpack.lib /pdb:C:\Users\fabia\code\SuiteSparse-org\UMFPACK\build\umfpack.pdb /dll /version:6.0 /machine:x64 /debug /INCREMENTAL /Qoption,link,/
DEF:CMakeFiles\umfpack.dir\exports.def C:\Users\fabia\code\SuiteSparse-org\SuiteSparse_config\build\suitesparseconfig.lib C:\Users\fabia\code\SuiteSparse-org\A
MD\build\amd.lib C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib\intel64\mkl_intel_lp64_dll.lib C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\
compiler\lib\intel64_win\libiomp5md.lib C:\Program Files (x86)\Intel\oneAPI\mkl\latest\lib\intel64\mkl_intel_thread_dll.lib C:\Program Files (x86)\Intel\oneAPI
\mkl\latest\lib\intel64\mkl_core_dll.lib C:\Users\fabia\code\SuiteSparse-org\CHOLMOD\build\cholmod.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.l
ib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\umfpack.dir/intermediate.manifest CMakeFiles\umfpack.dir/manife
st.res" failed (exit code 1120) with the following output:
LINK : warning LNK4044: Nicht erkannte Option /Qoption,link,/DEF:CMakeFiles\umfpack.dir\exports.def; wird ignoriert.
cholmod.lib(cholmod_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd_recommended" in Funktion "cholmod_colamd".
cholmod.lib(cholmod_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd_set_defaults" in Funktion "cholmod_colamd".
cholmod.lib(cholmod_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd" in Funktion "cholmod_colamd".
cholmod.lib(cholmod_l_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd_l_recommended" in Funktion "cholmod_l_colamd".      
cholmod.lib(cholmod_l_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd_l_set_defaults" in Funktion "cholmod_l_colamd".     
cholmod.lib(cholmod_l_colamd.c.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "colamd_l" in Funktion "cholmod_l_colamd".
umfpack.dll : fatal error LNK1120: 6 nicht aufgelöste Externe

Unfortunately I don't know how to set compiler output to Englisch - I find localized compiler output wired :(

The Metis issue is, that cholmod_metis_wrapper.c includes CHOLMOD\SuiteSparse_metis/GKlib/GKlib.h which complains about regex.h which is not available for standard Windows with Visual Studio and oneAPI installed.

It helps to set USE_GKREGEX for Metis to use not system regex. I do cmake .. -G "NMake Makefiles" -DCMAKE_C_FLAGS=/DUSE_GKREGEX for CHOLMOD but possibly this could be always done for all systems?

But then follows several further Windows specific error which I could not solve yet.

DrTimothyAldenDavis commented 1 year ago

Thanks for the feedback. I'm not sure what's happening with COLAMD not being found.

I don't need regex.h nor gkregex.h. Those are only needed by the METIS stand-alone executables, not the library itself. It should have gotten disabled in the cholmod_metis_wrapper.[ch] but I see it wasn't. I just revised that in the dev2 branch, just now.

UMFPACK doesn't directly rely on COLAMD. It relies (optionally) on CHOLMOD, which requires COLAMD. Somehow the transitive linking isn't working right. I can add those explicitly.

This is for a static library build, right?

DrTimothyAldenDavis commented 1 year ago

I guess that's the dynamic build. I misread the error messages.

It looks like this mechanism where cmake creates the .def files for dynamic .dll libraries doesn't handle the transitive linking of libraries. I'll need to fix the UMFPACK cmake build, and also SPQR (it requires CHOLMOD), to link in all of CHOLMOD's dependencies (AMD and COLAMD are required, and CAMD and CCOLAMD are optional).

mmuetzel commented 1 year ago

I'd guess the issue is:

LINK : warning LNK4044: Nicht erkannte Option /Qoption,link,/DEF:CMakeFiles\umfpack.dir\exports.def; wird ignoriert.

That means:

LINK : warning LNK4044: Ignoring unknown option /Qoption,link,/DEF:CMakeFiles\umfpack.dir\exports.def;.

I'd guess that flag would need to be just /DEF:CMakeFiles\umfpack.dir\exports.def because link.exe is used directly instead of being called via the compiler. That is probably also the reason why colamd.dll doesn't export those symbols...

DrTimothyAldenDavis commented 1 year ago

It might be that this method of having cmake create the *.def files leads to the requirement that all dependent libraries must be linked, even if they would normally be found because linking in cmake is transitive. See this page:

https://www.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/

where it states one of the issues:

"Not having fully linked libraries. On many Unix systems the linker will allow for shared libraries to have unresolved symbols at create time, that are expected to be resolved at the link time of the executable. Windows dlls must resolve all symbols, so your library must explicitly link to everything it depends on."

I've just modified the UMFPACK CMakeLists.txt file to link in COLAMD, CAMD, CCOLAMD, etc. Can you give it a try, on the dev2 branch? If that works, I can modify the other cmake scripts accordingly (SPQR and KLU in particular, since SPQR requires CHOLMOD, and KLU optionally uses CHOLMOD just like UMFPACK does).

mmuetzel commented 1 year ago

@Fabian188: I'd like to reproduce (and maybe help setup an action that compiles using MSVC). Could you please describe which tools you installed and which commands you used to compile SuiteSparse with MSVC/ifx?

Fabian188 commented 1 year ago

Here is what I get with current dev2. I still have a metis issue with CHOLMOD I bypass by setting NPARTITIONING. With this I can build CHOLMOD but get another issue with UMFPACK

fabia@LAPTOP-S9QEL64M C:\Users\fabia\code\SuiteSparse-org\UMFPACK\build>cmake .. -G "NMake Makefiles"                     
-- Building UMFPACK version: v6.0.3 (Jan 1, 2023)
-- Source:        C:/Users/fabia/code/SuiteSparse-org/UMFPACK 
-- Build:         C:/Users/fabia/code/SuiteSparse-org/UMFPACK/build
-- The C compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Install rpath:
-- Build   rpath: C:/Users/fabia/code/SuiteSparse-org/UMFPACK/build
-- Build type:    Debug
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- The Fortran compiler identification is IntelLLVM 2023.0.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Fortran: IntelLLVM
-- CUDA: not enabled
-- Found OpenMP_C: -openmp (found version "2.0") 
-- Found OpenMP_Fortran: -Qiopenmp (found version "5.0") 
-- Found OpenMP: TRUE (found version "2.0")  
-- Found SuiteSparse_config: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build/suitesparseconfig.lib (found suitable version "7.0.0", minim
um required is "7.0.0")
-- SuiteSparse_config version: 7.0.0
-- SuiteSparse_config include: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config
-- SuiteSparse_config library: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build/suitesparseconfig.lib
-- SuiteSparse_config static:  C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build/suitesparseconfig.lib
-- Found AMD: C:/Users/fabia/code/SuiteSparse-org/AMD/build/amd.lib (found suitable version "3.0.3", minimum required is "3.0.3") 
-- AMD version: 3.0.3
-- AMD include: C:/Users/fabia/code/SuiteSparse-org/AMD/include
-- AMD library: C:/Users/fabia/code/SuiteSparse-org/AMD/build/amd.lib
-- AMD static:  C:/Users/fabia/code/SuiteSparse-org/AMD/build/amd.lib
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Looking for Intel 32-bit BLAS
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Found BLAS: C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler/latest/w
indows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program Files (x
86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- Found Intel10_64lp 32-bit BLAS
-- Found CHOLMOD: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build/cholmod.lib (found suitable version "4.0.3", minimum required is "4.0.3") 
-- CHOLMOD version: 4.0.3
-- CHOLMOD include: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/include
-- CHOLMOD library: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build/cholmod.lib
-- CHOLMOD static:  C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build/cholmod.lib
-- Could NOT find CHOLMOD_CUDA: (Required is at least version "4.0.3") (found C:/Users/fabia/code/SuiteSparse-org/UMFPACK/CHOLMOD_CUDA_LIBRARY-NOTFOUN
D)
-- CHOLMOD_CUDA not found
-- Found COLAMD: C:/Users/fabia/code/SuiteSparse-org/COLAMD/build/colamd.lib (found suitable version "3.0.3", minimum required is "3.0.3") 
-- COLAMD version: 3.0.3
-- COLAMD include: C:/Users/fabia/code/SuiteSparse-org/COLAMD/include
-- COLAMD library: C:/Users/fabia/code/SuiteSparse-org/COLAMD/build/colamd.lib
-- COLAMD static:  C:/Users/fabia/code/SuiteSparse-org/COLAMD/build/colamd.lib
-- Found CAMD: C:/Users/fabia/code/SuiteSparse-org/CAMD/build/camd.lib (found suitable version "3.0.3", minimum required is "3.0.3") 
-- CAMD version: 3.0.3
-- CAMD include: C:/Users/fabia/code/SuiteSparse-org/CAMD/include
-- CAMD library: C:/Users/fabia/code/SuiteSparse-org/CAMD/build/camd.lib
-- CAMD static:  C:/Users/fabia/code/SuiteSparse-org/CAMD/build/camd.lib
-- Found CCOLAMD: C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/build/ccolamd.lib (found suitable version "3.0.3", minimum required is "3.0.3") 
-- CCOLAMD version: 3.0.3
-- CCOLAMD include: C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/include
-- CCOLAMD library: C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/build/ccolamd.lib
-- CCOLAMD static:  C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/build/ccolamd.lib
-- Using CHOLMOD for addtional pre-ordering options
-- OpenMP C libraries:       
-- OpenMP C include:
-- OpenMP C flags:          -openmp 
-- BLAS libraries:      C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler
/latest/windows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program
 Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- BLAS include:
-- BLAS linker flags:
-- Installation will be system-wide (requires 'sudo make install')
-- Skipping the demos in UMFPACK/Demo
-- ------------------------------------------------------------------------
-- SuiteSparse CMAKE report for: umfpack
-- ------------------------------------------------------------------------
-- install in C:/Program Files (x86): true
-- install in SuiteSparse/lib and SuiteSparse/include: false
-- build type:           Debug
-- NSTATIC:              false (build static library)
-- use OpenMP:           yes
-- C compiler:           C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- C flags:              /DWIN32 /D_WINDOWS -openmp
-- C++ compiler:
-- C++ flags:
-- C Flags debug:        /Zi /Ob0 /Od /RTC1
-- C++ Flags debug:
-- Fortran compiler:     C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- compile definitions:  BLAS_Intel10_64lp
-- BLAS integer:         int32_t
-- ------------------------------------------------------------------------
-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
C:/Users/fabia/code/SuiteSparse-org/UMFPACK/CHOLMOD_CUDA_LIBRARY
    linked by target "umfpack" in directory C:/Users/fabia/code/SuiteSparse-org/UMFPACK
CHOLMOD_CUDA_STATIC (ADVANCED)
    linked by target "umfpack_static" in directory C:/Users/fabia/code/SuiteSparse-org/UMFPACK

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

I want to add, that I need this not urgently as I switched to the 5.13. fork of serguid for Windows. But I think it is still helpful to make the original working on Windows.

This was the SuiteSparse_config

fabia@LAPTOP-S9QEL64M C:\Users\fabia\code\SuiteSparse-org\SuiteSparse_config\build>cmake .. -G "NMake Makefiles"
-- Building SuiteSparse_config version: v7.0.0 (Jan 1, 2023)
-- Source:        C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config 
-- Build:         C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build
-- The C compiler identification is MSVC 19.34.31937.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Install rpath:
-- Build   rpath: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build
-- Build type:    Debug
-- Looking for a Fortran compiler
-- Looking for a Fortran compiler - C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- The Fortran compiler identification is IntelLLVM 2023.0.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Fortran: IntelLLVM
-- CUDA: not enabled
-- Found OpenMP_C: -openmp (found version "2.0") 
-- Found OpenMP_Fortran: -Qiopenmp (found version "5.0") 
-- Found OpenMP: TRUE (found version "2.0")  
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Looking for Intel 32-bit BLAS
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Found BLAS: C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler/latest/w
indows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program Files (x
86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- Found Intel10_64lp 32-bit BLAS
-- OpenMP C libraries:       
-- OpenMP C include:
-- OpenMP C flags:          -openmp
-- BLAS libraries:      C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler
/latest/windows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program
 Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- BLAS linker flags:    
-- BLAS include:
-- Installation will be system-wide (requires 'sudo make install')
-- ------------------------------------------------------------------------
-- SuiteSparse CMAKE report for: suitesparseconfig
-- ------------------------------------------------------------------------
-- install in C:/Program Files (x86): true
-- install in SuiteSparse/lib and SuiteSparse/include: false
-- build type:           Debug
-- NSTATIC:              false (build static library)
-- use OpenMP:           yes
-- C compiler:           C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- C flags:              /DWIN32 /D_WINDOWS -openmp
-- C++ compiler:
-- C++ flags:
-- C Flags debug:        /Zi /Ob0 /Od /RTC1
-- C++ Flags debug:
-- Fortran compiler:     C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- compile definitions:  BLAS_Intel10_64lp
-- BLAS integer:         int32_t
-- ------------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build
Fabian188 commented 1 year ago

@mmuetzel I usually don't use Windows but macOS and Linux. BTW, Apple's M1 MacBooks are blazing fast for developing.

I borrowed a Win10 Notebook and installed current development tools, hence this could be a typical setup despite that I work almost only via the command line (via Window's openSSH server from macOS).

My setup is:

I always run setvars.bat from oneAPI which makes MSVC nmake availabe in the path.

My steps are always cmake .. -G "NMake Makefiles" and nmake in the corresponding SuiteSparse modules build directories.

For IntelLLVM C-Compiler icx I call set CC=icx before initial cmake, but here I leave it to the default which is MSVC and ifx.

In my (not fully mature) fork https://github.com/Fabian188/SuiteSparse-root-cmake I do this automatically, but here I do it manually - hence always with the defaults which includes static libs (what is I'm interested in at the end)

Fabian188 commented 1 year ago

This is the configure of CHOLMOD, indeed not CUDA found (but here no issue)

BTW, I could set CMAKE_BUILD_TYPE=Release, but maybe this would be good already as default?

fabia@LAPTOP-S9QEL64M C:\Users\fabia\code\SuiteSparse-org\CHOLMOD\build>cmake .. -G "NMake Makefiles" -DNPARTITION:BOOL=ON
-- Building CHOLMOD version: v4.0.3 (Jan 1, 2023)
-- Source:        C:/Users/fabia/code/SuiteSparse-org/CHOLMOD
-- Build:         C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build
-- Install rpath:  
-- Build   rpath: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build
-- Build type:    Debug
-- Fortran: IntelLLVM
-- Looking for CUDA
-- CUDA: not found
-- CUDA: not enabled
-- SuiteSparse_config version: 7.0.0
-- SuiteSparse_config include: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config
-- SuiteSparse_config library: C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build/suitesparseconfig.lib
-- SuiteSparse_config static:  C:/Users/fabia/code/SuiteSparse-org/SuiteSparse_config/build/suitesparseconfig.lib
-- COLAMD version: 3.0.3
-- COLAMD include: C:/Users/fabia/code/SuiteSparse-org/COLAMD/include
-- COLAMD library: C:/Users/fabia/code/SuiteSparse-org/COLAMD/build/colamd.lib
-- COLAMD static:  C:/Users/fabia/code/SuiteSparse-org/COLAMD/build/colamd.lib
-- AMD version: 3.0.3
-- AMD include: C:/Users/fabia/code/SuiteSparse-org/AMD/include
-- AMD library: C:/Users/fabia/code/SuiteSparse-org/AMD/build/amd.lib
-- AMD static:  C:/Users/fabia/code/SuiteSparse-org/AMD/build/amd.lib
-- CAMD version: 3.0.3
-- CAMD include: C:/Users/fabia/code/SuiteSparse-org/CAMD/include
-- CAMD library: C:/Users/fabia/code/SuiteSparse-org/CAMD/build/camd.lib
-- CAMD static:  C:/Users/fabia/code/SuiteSparse-org/CAMD/build/camd.lib
-- CCOLAMD version: 3.0.3
-- CCOLAMD include: C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/include
-- CCOLAMD library: C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/build/ccolamd.lib
-- CCOLAMD static:  C:/Users/fabia/code/SuiteSparse-org/CCOLAMD/build/ccolamd.lib
-- Looking for Intel 32-bit BLAS
-- Found Intel10_64lp 32-bit BLAS
-- Building CHOLMOD_CUDA version: v4.0.3 (Jan 1, 2023)
-- Source:        C:/Users/fabia/code/SuiteSparse-org/CHOLMOD 
-- Build:         C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build
-- Install rpath:
-- Build   rpath: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build;C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build
-- Build type:    Debug
-- Fortran: IntelLLVM
-- Looking for CUDA
-- CUDA: not found
-- CUDA: not enabled
-- Installation will be system-wide (requires 'sudo make install')
-- OpenMP C libraries:       
-- OpenMP C include:         
-- OpenMP C flags:          -openmp
-- BLAS libraries:      C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler
/latest/windows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program
 Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- BLAS include:
-- BLAS linker flags:
-- LAPACK libraries:    C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_lp64_dll.lib;C:/Program Files (x86)/Intel/oneAPI/compiler
/latest/windows/compiler/lib/intel64_win/libiomp5md.lib;C:/Program Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_intel_thread_dll.lib;C:/Program
 Files (x86)/Intel/oneAPI/mkl/latest/lib/intel64/mkl_core_dll.lib
-- LAPACK include:
-- LAPACK linker flags:
-- Installation will be system-wide (requires 'sudo make install')
-- Skipping the demos in CHOLMOD/Demo
-- ------------------------------------------------------------------------
-- SuiteSparse CMAKE report for: cholmod
-- ------------------------------------------------------------------------
-- install in C:/Program Files (x86): true
-- install in SuiteSparse/lib and SuiteSparse/include: false
-- build type:           Debug
-- NSTATIC:              false (build static library)
-- use OpenMP:           yes
-- C compiler:           C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- C flags:              /DWIN32 /D_WINDOWS   -openmp
-- C++ compiler:         C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- C++ flags:            /DWIN32 /D_WINDOWS /GR /EHsc -openmp
-- C Flags debug:        /Zi /Ob0 /Od /RTC1
-- C++ Flags debug:      /Zi /Ob0 /Od /RTC1
-- Fortran compiler:     C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe
-- compile definitions:  NPARTITION;BLAS_Intel10_64lp
-- BLAS integer:         int32_t
-- NPARTITION:           do not use METIS
-- ------------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/fabia/code/SuiteSparse-org/CHOLMOD/build
DrTimothyAldenDavis commented 1 year ago

OK. I didn't put a "if ( CHOLMOD_CUDA_FOUND)" guard around the linking to that optional library. I though the CHOLMOD_LIBRARY and CHOLMOD_STATIC strings would be empty if they weren't found, since this is not a required library.

I'll update my cmakes to account for that.

Fabian188 commented 1 year ago

I missread this statement and thought you already updated.

I could make umpfack compile with the following workaround

message("CHOLMOD_CUDA_LIBRARIES ${CHOLMOD_CUDA_LIBRARIES}")                                                                                        
message("CHOLMOD_CUDA_STATIC ${CHOLMOD_CUDA_STATIC}")                                                                                              

if("${CHOLMOD_CUDA_LIBRARIES}" MATCHES "NOTFOUND")                                                                                                 
  set(CHOLMOD_CUDA_LIBRARIES "")                                                                                                                   
  set(CHOLMOD_CUDA_STATIC "")                                                                                                                      
endif()                                                                                                                                            

message("CHOLMOD_CUDA_LIBRARIES ${CHOLMOD_CUDA_LIBRARIES}")                                                                                        
message("CHOLMOD_CUDA_STATIC ${CHOLMOD_CUDA_STATIC}")                                                                                              

# cholmod:                                                                                                                                         
if ( NOT NCHOLMOD )                                                                                                                                
    # link with CHOLMOD and its dependencies, both required and optional                                                                           
    target_link_libraries ( umfpack PUBLIC                                                                                                         
        ${CHOLMOD_LIBRARIES} ${CHOLMOD_CUDA_LIBRARIES}                                                                                             
        ${AMD_LIBRARIES} ${COLAMD_LIBRARIES}                                                                                                       
        ${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES} )                                                                                                   
    if ( NOT NSTATIC )                                                                                                                             
        target_link_libraries ( umfpack_static PUBLIC                                                                                              
            ${CHOLMOD_STATIC} ${CHOLMOD_CUDA_STATIC}                                                                                               
            ${AMD_STATIC} ${COLAMD_STATIC}                                                                                                         
            ${CAMD_STATIC} ${CCOLAMD_STATIC} )                                                                                                     
    endif ( )                                                                                                                                      
endif ( ) 

This gives

CHOLMOD_CUDA_LIBRARIES C:/Users/fabia/code/SuiteSparse-org/UMFPACK/CHOLMOD_CUDA_LIBRARY-NOTFOUND
CHOLMOD_CUDA_STATIC CHOLMOD_CUDA_STATIC-NOTFOUND
CHOLMOD_CUDA_LIBRARIES
CHOLMOD_CUDA_STATIC
DrTimothyAldenDavis commented 1 year ago

Thanks for the update. I'm modifying all of the Find*.cmake files in SuiteSparse. If the libraries are found, I set all these strings to the empty string.

I also found a few bugs in the parsing of the version numbers from the include files and so I've revised all of the Find*.cmake files accordingly.

I'll post an update to the dev2 and dev branches shortly.

realbabilu commented 1 year ago

Hi everyone. i just trying umfpack in windows enviroment for benchmarking with other solver.

i use Windows intel Compiler 2021 free then this is my fix for every CMAKElist.txt There is 2 version LLVM version : icx.exe and ifx.exe and old version icl.exe and ifort.exe the icx.exe the clang version is capable for C19, while icl.exe is not. the icx compatible for cholmod and cxsparse where c19 needed. For 64b long integer MKL in build directory: CMAKE -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=icx.exe -DCMAKE_BUILD_TYPE=RELEASE -DLOCAL_INSTALL=TRUE -DNSTATIC=FALSE -DBLA_VENDOR=Intel10_64ilp -DALLOW_64BIT_BLAS=TRUE -DNOPENMP=FALSE -DDEMO=TRUE -DCMAKE_Fortran_COMPILER=ifx.exe -DCMAKE_CXX_COMPILER=icx.exe ..

For 32b long integer MKL in build directory: CMAKE -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=icx.exe -DCMAKE_BUILD_TYPE=RELEASE -DLOCAL_INSTALL=TRUE -DNSTATIC=FALSE -DBLA_VENDOR=Intel10_64lp -DALLOW_64BIT_BLAS=FALSE -DNOPENMP=FALSE -DDEMO=TRUE -DCMAKE_Fortran_COMPILER=ifx.exe -DCMAKE_CXX_COMPILER=icx.exe .. Alternate can be use jom for faster multithread compiling -G"NMake Makefiles JOM"

  1. For compatibility with MSVC, since it windows compiler for every #libm each folder Cmakelists.txt use this modification

libm:

WINDOWS_INTEL_LLVM and WINDOWS_INTEL --> __WINDOWS_MSVC = 1

if ( NOT MSVC )

if (( NOT MSVC ) OR ( NOT __WINDOWS_MSVC ))
message ("M Enabled") target_link_libraries ( suitesparseconfig PUBLIC m ) if ( NOT NSTATIC ) target_link_libraries ( suitesparseconfig_static PUBLIC m ) endif ( ) endif ( )

Also Cmakelist.txt in suitesparse_metis if metis not used.

if ((MSVC) OR (__WINDOWS_MSVC ))
set (METIS_INSTALL FALSE) else() set (METIS_INSTALL TRUE) endif()


2.  there is several options i saw in cholmod and umfpack
     a. Suitesparse + AMD + UMFPACK --> this is icl.exe can be use.
     b. Suitesparse + AMD + COLAMD + CHOLMOD + UMFPACK --> this is icx.exe must be use with cmakelists mod.
     c. Suitesparse + AMD + COLAMD + CAMD + CCOLAMD + CHOLMOD + UMFPACK --> this is icx.exe version cmakelists mod.

gklib.h mod (those metis install false line above can be  commented / removed)
from..

if defined(WITHPCRE)

include

else

if defined(USE_GKREGEX)

#include "gkregex.h"

else

#include <regex.h>

endif / defined(USE_GKREGEX) /

endif / defined(WITHPCRE) /


to
`#include "gkregex.h"`

maybe added gkregex.h.pc added and renamed via cmake will make easier.

3. if using cholmod then umfpack usually failed to link because depedency with colamd, ccolamd , and camd not exist in umfpack cmakelists.txt, added in policies,dependencies

-------------------------------------------------------------------------------

SuiteSparse policies

-------------------------------------------------------------------------------

set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}

${CMAKE_SOURCE_DIR}/../COLAMD/cmake_modules
${CMAKE_SOURCE_DIR}/../CAMD/cmake_modules
${CMAKE_SOURCE_DIR}/../CCOLAMD/cmake_modules

${CMAKE_SOURCE_DIR}/cmake_modules
${CMAKE_SOURCE_DIR}/../AMD/cmake_modules
${CMAKE_SOURCE_DIR}/../CHOLMOD/cmake_modules
${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules )

include ( SuiteSparsePolicy )

-------------------------------------------------------------------------------

find library dependencies

-------------------------------------------------------------------------------

..... after if ( NCHOLMOD ) endif

Assummed build the Partition module if CAMD , CCOLAMD built with CHOLMOD

# look for CHOLMOD (optional fill-reducing orderings for KLU)
find_package ( CHOLMOD 4.0.2 )
find_package ( CCOLAMD 3.0.2 REQUIRED )
find_package ( CAMD 3.0.2 REQUIRED )    
find_package ( AMD 3.0.2 REQUIRED )
find_package ( COLAMD 3.0.2 REQUIRED )

if (( CAMD_FOUND ) AND ( CCOLAMD_FOUND ) AND (CHOLMOD_FOUND) AND ( COLAMD_FOUND ) AND ( AMD_FOUND )) 
    set ( PARTITIONED true )
endif ( )

-------------------------------------------------------------------------------

include directories

-------------------------------------------------------------------------------

......

if (PARTITIONED) include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} ${AMD_INCLUDE_DIR} ${CHOLMOD_INCLUDE_DIR} ${CAMD_INCLUDE_DIR} ${COLAMD_INCLUDE_DIR} ${CCOLAMD_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/../AMD/Include ${CMAKE_SOURCE_DIR}/../CAMD/Include ${CMAKE_SOURCE_DIR}/../COLAMD/Include ${CMAKE_SOURCE_DIR}/../CCOLAMD/Include ) endif (PARTITIONED)

-------------------------------------------------------------------------------

add the library dependencies

-------------------------------------------------------------------------------

--after if if ( NOT NCHOLMOD ) finish

partition cholmod:

if ( PARTITIONED ) target_link_libraries ( umfpack PUBLIC ${CHOLMOD_LIBRARIES} ${AMD_LIBRARIES} ${COLAMD_LIBRARIES} ${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES}) if ( NOT NSTATIC ) target_link_libraries ( umfpack_static PUBLIC ${CHOLMOD_LIBRARIES} ${AMD_LIBRARIES} ${COLAMD_LIBRARIES} ${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES}) endif ( ) endif ( )


4. Please Added UPPERCASE non underscore in umf4_f77wrapper.c for Windows Intel Fortran compatibility, for Zwapper too about similar.

/ ========================================================================== / / === with UPCASE +++++++=================================================== / / ========================================================================== /

/ Microsoft Windows Tntel Fortran Compaq Visual Fortran as well. /

/ -------------------------------------------------------------------------- / / umf4def: set default control parameters / / -------------------------------------------------------------------------- /

/ call umf4def (control) /

void UMF4DEF (double Control [UMFPACK_CONTROL]) { UMFPACK_defaults (Control) ; }

/ -------------------------------------------------------------------------- / / umf4pcon: print control parameters / / -------------------------------------------------------------------------- /

/ call umf4pcon (control) /

void UMF4PCON (double Control [UMFPACK_CONTROL]) { fflush (stdout) ; UMFPACK_report_control (Control) ; fflush (stdout) ; }

/ -------------------------------------------------------------------------- / / umf4sym: pre-ordering and symbolic factorization / / -------------------------------------------------------------------------- /

/ call umf4sym (m, n, Ap, Ai, Ax, symbolic, control, info) /

void UMF4SYM (Int m, Int n, Int Ap [ ], Int Ai [ ], double Ax [ ], void *Symbolic, double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { (void) UMFPACK_symbolic (m, *n, Ap, Ai, Ax, Symbolic, Control, Info) ; }

/ -------------------------------------------------------------------------- / / umf4num: numeric factorization / / -------------------------------------------------------------------------- /

/ call umf4num (Ap, Ai, Ax, symbolic, numeric, control, info) /

void UMF4NUM (Int Ap [ ], Int Ai [ ], double Ax [ ], void Symbolic, void Numeric, double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { (void) UMFPACK_numeric (Ap, Ai, Ax, *Symbolic, Numeric, Control, Info); }

/ -------------------------------------------------------------------------- / / umf4solr: solve a linear system with iterative refinement / / -------------------------------------------------------------------------- /

/ call umf4solr (sys, Ap, Ai, Ax, x, b, numeric, control, info) /

void UMF4SOLR (Int *sys, Int Ap [ ], Int Ai [ ], double Ax [ ], double x [ ], double b [ ], void *Numeric, double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { (void) UMFPACK_solve (sys, Ap, Ai, Ax, x, b, *Numeric, Control, Info) ; }

/ -------------------------------------------------------------------------- / / umf4sol: solve a linear system without iterative refinement / / -------------------------------------------------------------------------- /

/ call umf4sol (sys, x, b, numeric, control, info) /

void UMF4SOL (Int *sys, double x [ ], double b [ ], void *Numeric, double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { Control [UMFPACK_IRSTEP] = 0 ; (void) UMFPACK_solve (sys, (Int ) NULL, (Int ) NULL, (double ) NULL, x, b, Numeric, Control, Info) ; }

/ -------------------------------------------------------------------------- / / umf4scal: scale a vector using UMFPACK's scale factors / / -------------------------------------------------------------------------- /

/ call umf4scal (x, b, numeric, status) /

void UMF4SCAL (double x [ ], double b [ ], void *Numeric, Int status) { status = UMFPACK_scale (x, b, Numeric) ; }

/ -------------------------------------------------------------------------- / / umf4pinf: print info / / -------------------------------------------------------------------------- /

/ call umf4pinf (control) /

void UMF4PINF (double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO]) { fflush (stdout) ; UMFPACK_report_info (Control, Info) ; fflush (stdout) ; }

/ -------------------------------------------------------------------------- / / umf4fnum: free the Numeric object / / -------------------------------------------------------------------------- /

/ call umf4fnum (numeric) /

void UMF4FNUM (void **Numeric) { UMFPACK_free_numeric (Numeric) ; }

/ -------------------------------------------------------------------------- / / umf4fsym: free the Symbolic object / / -------------------------------------------------------------------------- /

/ call umf4fsym (symbolic) /

void UMF4FSYM (void **Symbolic) { UMFPACK_free_symbolic (Symbolic) ; }

/ -------------------------------------------------------------------------- / / umf4snum: save the Numeric object to a file / / -------------------------------------------------------------------------- /

/ call umf4snum (numeric, filenum, status) /

void UMF4SNUM (void *Numeric, Int filenum, Int status) { char filename [LEN] ; make_filename (filenum, "n", filename) ; status = UMFPACK_save_numeric (Numeric, filename) ; }

/ -------------------------------------------------------------------------- / / umf4ssym: save the Symbolic object to a file / / -------------------------------------------------------------------------- /

/ call umf4ssym (symbolic, filenum, status) /

void UMF4SSYM (void *Symbolic, Int filenum, Int status) { char filename [LEN] ; make_filename (filenum, "s", filename) ; status = UMFPACK_save_symbolic (Symbolic, filename) ; }

/ -------------------------------------------------------------------------- / / umf4lnum: load the Numeric object from a file / / -------------------------------------------------------------------------- /

/ call umf4lnum (numeric, filenum, status) /

void UMF4LNUM (void *Numeric, Int filenum, Int status) { char filename [LEN] ; make_filename (filenum, "n", filename) ; *status = UMFPACK_load_numeric (Numeric, filename) ; }

/ -------------------------------------------------------------------------- / / umf4lsym: load the Symbolic object from a file / / -------------------------------------------------------------------------- /

/ call umf4lsym (symbolic, filenum, status) /

void UMF4LSYM (void *Symbolic, Int filenum, Int status) { char filename [LEN] ; make_filename (filenum, "s", filename) ; *status = UMFPACK_load_symbolic (Symbolic, filename) ; }


6. Somehow i cant inverse the dense unsymmetric matrix with UMFPACK that worked with SuperLu or DGETRI.
    the input matrix for Superlu is same as UMFPACK right? the different is the 1 to 0 matrix changer is on fortran itself, while superlu in on wrapper c_fortran_dgssv.c .
Fabian188 commented 1 year ago

Did you use a current dev2 as your basis?

Just a note: oneAPI 2023.0 gives for usage of icl (classic Intel C/C++ compiler) the warning, that icl will be removed from productive mid 2023. So support for icl is from my point of view not essential.

realbabilu commented 1 year ago

Did you use a current dev2 as your basis?

Just a note: oneAPI 2023.0 gives for usage of icl (classic Intel C/C++ compiler) the warning, that icl will be removed from productive mid 2023. So support for icl is from my point of view not essential.

Dev2? Sorry i dont know what you mean. I downloaded sparsesuite zip file 6.0.2 from this site last month.

Fabian188 commented 1 year ago

This thread discusses issues with MSVC and currently on the branch dev2 Tim Davis pushed changes which made CHOLMOD/UMFPACK compile for me with MSVC and icx. Some of the changes you propose are already on dev2.

dev2 is only available by cloning the code and switching the branch. But probably the changes become a new (beta) release anyway soon.

If you click on branches you'll see dev and dev2.

Bildschirmfoto 2023-01-02 um 16 44 06
DrTimothyAldenDavis commented 1 year ago

Please try the version currently on the dev2 branch. That should resolve most of the MSVC issues. I just pushed some additional changes to the dev2 branch that resolves more of them.

DrTimothyAldenDavis commented 1 year ago

For the Fortan-callable methods with upper case names and no underscore: I can add those easily. I won't use the method you have above, though, where each method is explicitly defined. It's simpler to fold all three cases into 3 uses of a single template file. I'll post an update to the dev2 branch shortly.

DrTimothyAldenDavis commented 1 year ago

Try the latest dev2 branch. I added all-upper case names with no underscore, for both real and complex methods. I also added 64-bit integer versions for the complex case, which I didn't have before. I augmented the Fortran demos as well, to test these. You can test with with make fdemos in the top-level UMFPACK folder, or (if you don't have 'make'), just run those commands under the fdemos: target from the Makefile.

I think this update should resolve all your issues, @realbabilu. Can you give it a try and let me know how it works?

DrTimothyAldenDavis commented 1 year ago

Let me know if you'd like me to tag this as a v7.0.0.beta1 pre-release. Then you could download it as a zip file instead of using git to checkout the dev2 branch.

realbabilu commented 1 year ago

Hi 2 morning in here

here is the result: AMD,CAMD,CCOLAMD,COLAMD,BTF,CHOLMOD,KLU,LDL,CSPARSE,CXSPARSE,UMFPACK works. FORTRAN EXAMPLES WORKS...i was downloaded when you uploaded a new one.. 👍 just compiled the very very latest one..

non working are:

  1. SPQR
    
    Creating library spqr.lib and object spqr.exp
    spqr_front.cpp.obj : error LNK2019: unresolved external symbol ZLAR referenced in function "__int64 __cdecl spqr_front<class std::complex<double> >(__int64,__int64,__int64,double,__int64,__int64,class std::complex<double> *,__int64 *,char *,class std::complex<double> *,class std::complex<double> *,double *,double *,struct cholmod_common_struct *)" (??$spqr_front@V?$complex@N@std@@@@YA_J_J00N00PEAV?$complex@N@std@@PEA_JPEAD11PEAN4PEAUcholmod_common_struct@@@Z)
2. SPEX
   it need module GMPthat only works on cygwin/equation.com/msys. maybe pre compiled cross can work.

CMake Error at cmake_modules/FindGMP.cmake:90 (string): string sub-command REGEX, mode MATCH needs at least 5 arguments total to command. Call Stack (most recent call first): CMakeLists.txt:52 (find_package)

DrTimothyAldenDavis commented 1 year ago

Thanks for the update. The latest push to UMFPACK should have the uppercase names with no underscore.

The ZLAR was a typo on my part. It was uncaught before, since none of the systems I tested so far use all-upper-case names for Fortran. See the latest commit to dev2 with the 'bug fix: ZLAR should be ZLARF' commit.

The gmp error is curious. It's complaining can't find the last digit of the version (the "1" in v6.2.1). The first two REGEX commands seem to be OK, which means that cmake found gmp.h and parsed it correctly. Perhaps you have a different gmp version, or maybe my parsing is causing trouble. I tweaked the FindGMP.cmake script.

DrTimothyAldenDavis commented 1 year ago

See this commit: https://github.com/DrTimothyAldenDavis/SuiteSparse/commit/7162dfd9fa619231b42d293209af50bcda734fdf

realbabilu commented 1 year ago

Thanks for the update. The latest push to UMFPACK should have the uppercase names with no underscore.

The ZLAR was a typo on my part. It was uncaught before, since none of the systems I tested so far use all-upper-case names for Fortran. See the latest commit to dev2 with the 'bug fix: ZLAR should be ZLARF' commit.

The gmp error is curious. It's complaining can't find the last digit of the version (the "1" in v6.2.1). The first two REGEX commands seem to be OK, which means that cmake found gmp.h and parsed it correctly. Perhaps you have a different gmp version, or maybe my parsing is causing trouble. I tweaked the FindGMP.cmake script.

Yes SPQR works perfect in windows GCC 13 64bit equation.com, still error in SPEX. Others fine with OpenBlas CMAKE -G"MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=make.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc.exe -DCMAKE_BUILD_TYPE=RELEASE -DLOCAL_INSTALL=TRUE -DNSTATIC=FALSE -DBLA_VENDOR=OpenBLAS -DALLOW_64BIT_BLAS=FALSE -DNOPENMP=FALSE -DDEMO=TRUE -DCMAKE_Fortran_COMPILER=gfortran.exe -DCMAKE_CXX_COMPILER=g++.exe .. -DBLAS_LIBRARIES:PATH="C:\gcc\openblas\libopenblas.dll.a" -DLAPACK_LIBRARIES:PATH="C:\gcc\openblas\libopenblas.dll.a"

Maybe later i can check speed test OpenBLAS GCC vs MKL IntelOpenAPI or ACML if i had time

DrTimothyAldenDavis commented 1 year ago

Thanks for the update. So the only thing still broken for you is SPEX, because of the GMP library?

mmuetzel commented 1 year ago

yes maybe GMP not destined for windows.

It is distributed by MSYS2 for native Windows: https://packages.msys2.org/base/mingw-w64-gmp

It should probably work for your build with GCC. I don't know how well that version would combine with MSVC though.

DrTimothyAldenDavis commented 1 year ago

So perhaps using SPEX on Windows is limited to using MINGW, not MSVC.

DrTimothyAldenDavis commented 1 year ago

It looks like the latest version of SuiteSparse on the dev2 branch is ready to become the SuiteSparse v7.0.0.beta1 pre-release. @mmuetzel , @Fabian188 , @realbabilu : let me know if you have any issues that are still pending.

If the only thing left is that SPEX won't work with MSVC (but will with MINGW64), then perhaps this issue can be closed.

mmuetzel commented 1 year ago

Or at least someone would need to try building the dependencies with MSVC. Linking to the version built with GCC might also work. I don't have much experience with combining libraries from different toolchains though...

mmuetzel commented 1 year ago

let me know if you have any issues that are still pending.

Not related to this report. But it might still be nice to fix the API for 32-bit platforms (#221)...

DrTimothyAldenDavis commented 1 year ago

Yes, I was thinking about when to do that. If I do it for v7.0.0, it will delay the release for a while. Maybe a few weeks. Or I could release v7.0.0 soon, and then add the 32-bit functions for SPQR in SuiteSparse v7.1.0.

DrTimothyAldenDavis commented 1 year ago

Other issues to resolve in the future include: https://github.com/DrTimothyAldenDavis/GraphBLAS/issues/187 and https://github.com/DrTimothyAldenDavis/GraphBLAS/issues/194 . I could wait to fix those for SuiteSparse v7.1.0, since they will take some time to figure out the best solution.

realbabilu commented 1 year ago

Thanks. SPQR works for intel compiler too. I just dont know how to put source code MPFR and GMP that made findGMP.cmake or findMPFR.cmake found and built it. maybe spex need a compiled binary ones. The binary MinGW OpenBLAS is can be linked using Intel MKL windows also, i cant find binary release GMP or MPFR that could linked.

DrTimothyAldenDavis commented 1 year ago

Thanks for checking that for SPQR.

For SPEX, I will add a note in the README or user guide, stating that on Windows, MINGW / MSYS2 is needed in place of MSVC.

For GraphBLAS on Windows: I'll add a note that MSVC doesn't work with the Ninja generator.

mmuetzel commented 1 year ago

I got everything to build with Intel igx and MKL libraries except SPEX so far. I'll try linking with the GMP and MPFR libraries from MSYS2. But maybe tomorrow. It's getting late here...

mmuetzel commented 1 year ago

Experimenting with MSVC: While gcc and igx seem to be able to link to a .dll file on Windows, MSVC is not. That leads to issues with the FindSuiteSparse_config.cmake module because it sets SUITESPARSE_CONFIG_LIBRARY to the full path to suitesparseconfig.dll. This leads to linker errors like the following:

D:\SuiteSparse\SuiteSparse_config\build\Debug\suitesparseconfig.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x338 [D:\SVN\Octave\SuiteSparse\Mongoose\build\mongoose_exe.vcxpr
oj]

It should be setting SUITESPARSE_CONFIG_LIBRARY to the full path to the import library suitesparseconfig.lib.

DrTimothyAldenDavis commented 1 year ago

I gave it a try in the latest commit to dev2, and PR to dev.

mmuetzel commented 1 year ago

I'm currently trying to set up CI rules for MSVC with GitHub actions. It's not quite there yet. But at least it started to compile something: see #260

DrTimothyAldenDavis commented 1 year ago

I think this issue is resolved with v7.0.0.beta1. @Fabian188 : Can you give that version a try in MSVC just to be sure? If so, then we can close this issue (and then if there are future issues with v7.0.0.beta1 or beta2, etc, we can start a new issue).

Fabian188 commented 1 year ago

I just cloned dev

git log
commit 1c023e2dcd44def2ce8c4a3042e8034e4cd96c8d (HEAD -> dev, origin/dev, origin/HEAD)
Merge: ce7785881 4bd083fa0
Author: Tim Davis <DrTimothyAldenDavis@gmail.com>
Date:   Tue Jan 10 17:09:23 2023 -0600

    Merge pull request #274 from DrTimothyAldenDavis/dev2

    minor updates for v7.0.0.beta1

And built with cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release on a fresh system with Visual Studio Community and Intels oneAPI baseKit and hpcKit. The compilers are MSVC 19.34.31937.0 and for Fortran IntelLLVM 2023.0.0 with MSVC-like command-line

I built up to CHOLMOD and UMFPACK and all was fine. The only warnings were from UMPACK like warning C4068: unknown pragma "ivdep" which can be clearly safely ignored.

I got umfpack.dll and umfpack_static.lib.

All fine!! Thanks a lot.