Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSVC/Flang support (Windows) #56

Merged
merged 10 commits into from
Mar 18, 2020
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .azure-pipelines/azure-pipelines-win.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions .ci_support/win_.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions .ci_support/win_c_compilervs2015vc14.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
c_compiler:
- vs2015
channel_sources:
- conda-forge,defaults
channel_targets:
- conda-forge main
fortran_compiler:
- flang
fortran_compiler_version:
- '5'
libblas:
- 3.8 *netlib
liblapack:
- 3.8.0 *netlib
mpi:
- nompi
pin_run_as_build:
vc:
max_pin: x
vc:
- '14'
zip_keys:
- - vc
- c_compiler
1 change: 1 addition & 0 deletions .gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions recipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ project(MUMPS Fortran C)
###############################################################################
# Options
###############################################################################
add_definitions(-DAdd_)


find_package(BLAS)
Expand Down Expand Up @@ -50,6 +49,7 @@ endif()

include_directories(
${MUMPS_SOURCE_DIR}/include
${MUMPS_SOURCE_DIR}/src
${MUMPS_SOURCE_DIR}/PORD/include
)

Expand Down Expand Up @@ -126,6 +126,10 @@ if(NOT WITH_MPI)
endif()

add_library(mumps_common STATIC ${COMMON_MOD} ${COMMON_OTHER})
target_compile_definitions(mumps_common PRIVATE -DAdd_)
# Hack to fix incorrect assumption that Windows=gfortran
target_compile_definitions(mumps_common PRIVATE -DMUMPS_CALL=__declspec\(dllexport\))
target_compile_definitions(mumps_common PRIVATE -DLIBSEQ_CALL=__declspec\(dllexport\))

set(PORD_SOURCES
PORD/lib/graph.c
Expand Down Expand Up @@ -257,15 +261,21 @@ set(ARITHLIB ${ARITH}mumps)
set(EXAMPLE examples/${ARITH}simpletest.F)

add_library(${ARITHLIB} SHARED ${ARITH_MOD} ${ARITH_OTHER})
set_target_properties(${ARITHLIB} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
target_compile_definitions(${ARITHLIB} PUBLIC MUMPS_ARITH=MUMPS_ARITH_${ARITH})
# Hack to fix incorrect assumption that Windows=gfortran
target_compile_definitions(${ARITHLIB} PRIVATE -DAdd_)
target_compile_definitions(${ARITHLIB} PRIVATE -DMUMPS_CALL=__declspec\(dllexport\))
add_executable(${ARITH}simpletest ${EXAMPLE})
target_link_libraries(${ARITHLIB} mumps_common pord ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
target_link_libraries(${ARITH}simpletest ${ARITHLIB} mumps_common pord ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
install(TARGETS ${ARITHLIB} DESTINATION bin)
install(FILES include/${ARITH}mumps_struc.h include/${ARITH}mumps_root.h include/${ARITH}mumps_c.h DESTINATION include)

endforeach(ARITH)

set(EXAMPLE examples/c_example.c)
add_executable(c_example ${EXAMPLE})
target_link_libraries(c_example dmumps mumps_common pord ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
install(TARGETS mumps_common pord DESTINATION lib)
install(FILES include/mumps_c_types.h include/mumps_compat.h DESTINATION include)
if(NOT WITH_MPI)
Expand Down
20 changes: 10 additions & 10 deletions recipe/bld-seq.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ copy %RECIPE_DIR%\CMakeLists.txt %src%\CMakeLists.txt
mkdir build
cd build

REM This is a fix for a CMake bug where it crashes because of the "/GL" flag
REM See: https://gitlab.kitware.com/cmake/cmake/issues/16282
set CXXFLAGS=%CXXFLAGS:-GL=%
set CFLAGS=%CFLAGS:-GL=%

:: Configure using the CMakeFiles
cmake -G "MinGW Makefiles" ^
-DCMAKE_INSTALL_PREFIX:PATH="%LIBRARY_PREFIX%\mingw-w64" ^
cmake -G "NMake Makefiles" ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE:STRING=Release ^
-DCMAKE_SH="CMAKE_SH-NOTFOUND" ^
..
if errorlevel 1 exit 1

:: Build!
mingw32-make
cmake --build . --config Release --target install
if errorlevel 1 exit 1

:: Install!
mingw32-make install
%src%\build\c_example < %src%\examples\input_simpletest_real
if errorlevel 1 exit 1

%src%\build\ssimpletest < %src%\examples\input_simpletest_real
if errorlevel 1 exit 1
%src%\build\dsimpletest < %src%\examples\input_simpletest_real
Expand Down
60 changes: 60 additions & 0 deletions recipe/flang-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
--- mumps/src/mumps_common_orig.h
+++ mumps/src/mumps_common.h
@@ -27,7 +27,7 @@
* knowledge, there is no way to perform the conversion with CPP
* directives only.
*/
-#if defined(UPPER) || defined(MUMPS_WIN32)
+#if defined(UPPER)
# define F_SYMBOL(lower_case,upper_case) MUMPS_##upper_case
#elif defined(Add_)
# define F_SYMBOL(lower_case,upper_case) mumps_##lower_case##_
--- mumps/src/mumps_c_orig.c
+++ mumps/src/mumps_c.c
@@ -42,7 +42,7 @@
* CMUMPS_XXX in the code to get rid of any symbol convention annoyance.
*/
#if MUMPS_ARITH == MUMPS_ARITH_s
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) SMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) smumps_##lower_case##_
@@ -52,7 +52,7 @@
# define F_SYM_ARITH(lower_case,upper_case) smumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_d
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) DMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) dmumps_##lower_case##_
@@ -62,7 +62,7 @@
# define F_SYM_ARITH(lower_case,upper_case) dmumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_c
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) CMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) cmumps_##lower_case##_
@@ -72,7 +72,7 @@
# define F_SYM_ARITH(lower_case,upper_case) cmumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_z
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) ZMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) zmumps_##lower_case##_
--- mumps/libseq/elapse_orig.h
+++ mumps/libseq/elapse.h
@@ -24,7 +24,7 @@
#endif
#endif

-#if (defined(_WIN32) && ! defined(__MINGW32__)) || defined(UPPER)
+#if defined(UPPER)
#define mumps_elapse MUMPS_ELAPSE
#elif defined(Add__)
#define mumps_elapse mumps_elapse__
44 changes: 25 additions & 19 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ source:
- shared-mumps.patch
- shared-libseq.patch
- examples-mpilibs.patch
- flang-support.patch

build:
number: 5
number: 6
skip: true # [win and vc<14]

requirements:
build:
# dummy unused top-level requirements
# needed to construct the right conda-smithy matrix
- {{ compiler('fortran') }} # [unix]
- {{ compiler('m2w64_fortran') }} # [win]
- {{ compiler('c') }} # [unix]
- {{ compiler('m2w64_c') }} # [win]
- {{ compiler('fortran') }}
- {{ compiler('c') }}
- m2-patch # [win]
- mpi * {{ mpi }} # [mpi != 'nompi']

outputs:
Expand All @@ -47,15 +48,13 @@ outputs:
script: "%RECIPE_DIR%\\bld-seq.bat" # [win]
run_exports:
- {{ pin_subpackage('mumps-seq', max_pin='x.x.x') }} # [not win]
skip: true # [mpi != 'nompi']
skip: true # [(win and vc<14) or mpi != 'nompi']
requirements:
build:
- cmake # [win]
- m2-patch # [win]
- {{ compiler('fortran') }} # [unix]
- {{ compiler('m2w64_fortran') }} # [win]
- {{ compiler('c') }} # [unix]
- {{ compiler('m2w64_c') }} # [win]
- {{ compiler('fortran') }}
- {{ compiler('c') }}
host:
- libblas
- liblapack
Expand Down Expand Up @@ -90,13 +89,20 @@ outputs:
- test -f "${PREFIX}/include/mumps_seq/mpi.h"
- test -f "${PREFIX}/include/mumps_seq/mpif.h"
{% else %}
- if not exist "%LIBRARY_PREFIX%\mingw-w64\bin\libsmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\bin\libdmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\bin\libcmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\bin\libzmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\lib\libmumps_common.a" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\lib\libpord.a" exit 1
- if not exist "%LIBRARY_PREFIX%\mingw-w64\include\dmumps_struc.h" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\smumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\smumps.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\dmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\dmumps.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\cmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\cmumps.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\zmumps.dll" exit 1
- if not exist "%LIBRARY_PREFIX%\bin\zmumps.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\lib\mumps_common.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\lib\pord.lib" exit 1
- if not exist "%LIBRARY_PREFIX%\include\dmumps_struc.h" exit 1
- if not exist "%LIBRARY_PREFIX%\include\mumps_compat.h" exit 1
- if not exist "%LIBRARY_PREFIX%\include\mumps_seq\mpi.h" exit 1
- if not exist "%LIBRARY_PREFIX%\include\mumps_seq\mpif.h" exit 1
{% endif %}

- name: mumps-mpi
Expand All @@ -108,8 +114,8 @@ outputs:
features:
requirements:
build:
- {{ compiler('fortran') }} # [not win]
- {{ compiler('c') }} # [not win]
- {{ compiler('fortran') }}
- {{ compiler('c') }}
host:
- libblas
- liblapack
Expand Down