-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
bump to latest hdf5 version and windows fortran support w/flang #217
base: main
Are you sure you want to change the base?
Conversation
@conda-forge-admin, please rerender |
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
…nda-forge-pinning 2024.04.16.09.40.08
@conda-forge-admin, please rerender |
…nda-forge-pinning 2024.04.16.09.40.08
Hey @h-vetinari, I tried flang-new here in hopes of compiling HDF5 with fortran enabled on windows. Unfortunately it fails during the configuration :( Any ideas where I ought to start looking? (I have posted a question about this on the flang-compiler slack channel also).
Based on
I had hopes that this could work given that it seems LLVM flang compiles HDF5 on linux. |
@conda-forge-admin, please rerender |
…nda-forge-pinning 2024.04.18.09.07.49
Okay, here's another update. Regarding the flang windows error. It seems the previous reported error was a simple CMake config forcing invalid flang comands. I added a patch for that which seems to work. The error we're seeing now is
And by closer inspection of the
it seems this might be related to llvm/llvm-project#77282. |
Hey, here's a small update. Once llvm/llvm-project#89403 is fixed it might be possible to compile HDF5 with fortran enabled on Windows using LLVM FLang. Related to HDFGroup/hdf5#4419 I'll just convert this PR to a draft for now (pending fix for LLVM flang). |
…est-hdf5 # Conflicts: # .ci_support/osx_64_mpimpich.yaml # .ci_support/osx_64_mpinompi.yaml # .ci_support/osx_64_mpiopenmpi.yaml # recipe/bld.bat # recipe/conda_build_config.yaml # recipe/meta.yaml
It sounds like the |
... which is because the |
Hey @h-vetinari, I was going to make a patch, so I have been trying a few different approaches locally where I force the appropriate flags to the FORTRAN_RUN (and the CMAKE build logs confirm that the flags are passed in). But it still seems like the Are you sure we aren't missing anything else? I tried to simplify this by modifying the previous batch file example I made by doing this: @echo off
setlocal enabledelayedexpansion
:: need to read clang version for path to compiler-rt
FOR /F "tokens=* USEBACKQ" %%F IN (`clang.exe -dumpversion`) DO (
SET "CLANG_VER=%%F"
)
set CL_LIBDIR=%CONDA_PREFIX:/=/%/Library/lib/clang/!CLANG_VER:~0,2!/lib/windows
set "FFLAGS=-D_CRT_SECURE_NO_WARNINGS -D_MT -D_DLL --target=x86_64-pc-windows-msvc"
set "LDFLAGS=-fms-runtime-lib=dll -fuse-ld=lld"
set "LDFLAGS=%LDFLAGS% -Wl,-defaultlib:%CL_LIBDIR%/clang_rt.builtins-x86_64.lib"
set "CLI_ARGS=%FFLAGS% %LDFLAGS%"
flang-new %CLI_ARGS% read_and_integer_kinds.f90 -o read_and_integer_kinds.exe -v
call read_and_integer_kinds.exe
endlocal That ends up with the following error output flang-new version 19.1.0-rc2
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Work\Miniforge3\envs\flangdev\Library\bin
"C:\\Work\\Miniforge3\\envs\\flangdev\\Library\\bin\\flang-new" -fc1 -triple x86_64-pc-windows-msvc19.40.33811 -emit-obj -D _CRT_SECURE_NO_WARNINGS -D _MT -D _DLL -mrelocation-model pic -pic-level 2 -target-cpu x86-64 --dependent-lib=clang_rt.builtins-x86_64.lib -D_MT -D_DLL --dependent-lib=msvcrt --dependent-lib=FortranRuntime.dynamic.lib --dependent-lib=FortranDecimal.dynamic.lib -D_MSC_VER=1940 -D_MSC_FULL_VER=194033811 -D_WIN32 -D_M_X64=100 -resource-dir "C:\\Work\\Miniforge3\\envs\\flangdev\\Library\\lib\\clang\\19" -mframe-pointer=none -o "C:\\Users\\KRISTO~1\\AppData\\Local\\Temp\\read_and_integer_kinds-87ae5c.o" -x f95-cpp-input read_and_integer_kinds.f90
"C:\\Work\\Miniforge3\\envs\\flangdev\\Library\\bin\\lld-link" -out:read_and_integer_kinds.exe "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\lib\\x64" "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Tools\\MSVC\\14.40.33807\\atlmfc\\lib\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\ucrt\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\um\\x64" "-libpath:C:\\Work\\Miniforge3\\envs\\flangdev\\Library\\lib" /subsystem:console "-libpath:C:\\Work\\Miniforge3\\envs\\flangdev\\Library\\lib\\clang\\19\\lib\\windows" -nologo "-defaultlib:C:\\Work\\Miniforge3\\envs\\flangdev/Library/lib/clang/19/lib/windows/clang_rt.builtins-x86_64.lib" "C:\\Users\\KRISTO~1\\AppData\\Local\\Temp\\read_and_integer_kinds-87ae5c.o"
lld-link: error: could not open 'clang_rt.builtins.lib': no such file or directory
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
'read_and_integer_kinds.exe' is not recognized as an internal or external command,
operable program or batch file. Is there something not working with the |
The variables
points to the "wrong" library (compare with LDFLAGS which points to But looking at some of the logs, it appears that lld-link is perhaps in windows-only mode, because otherwise it shouldn't complain about the following arguments:
|
# Conflicts: # .ci_support/win_64_mpiimpi.yaml # .ci_support/win_64_mpinompi.yaml # recipe/meta.yaml
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( For recipe/meta.yaml:
|
@conda-forge-admin, please rerender |
…nda-forge-pinning 2024.10.12.05.36.28
@conda-forge-admin, please rerender |
Hi! This is the friendly automated conda-forge-linting service. I wanted to let you know that I linted all conda-recipes in your PR ( Here's what I've got... For recipe/meta.yaml:
For recipe/meta.yaml:
|
Hey @h-vetinari and @mjklemm. I thought I would revisit this. Seeing as the HDF5 configuration still fails on the kinds check (see #217 (comment) for reference) on windows. @mjklemm Did you manage to compile hdf5 on windows using a locally compiled version of flang? If so I might want to test compiling it for myself just to see what we're doing differently in our conda-forge build. I thought I would simply skip this check by simply hardcoding the supported real and integers by flang. By doing something like this I managed to finish the configuration step, and start compiling! if (CMAKE_Fortran_COMPILER MATCHES "flang")
message(STATUS "PROG_OUTPUT=${PROG_OUTPUT}. Force override with \"1,4,8;4,8,16;33;3;3;4;1,4,8;\"")
set(PROG_OUTPUT "1,4,8;4,8,16;33;3;3;4;1,4,8;")
else ()
# Convert the string to a list of strings by replacing the carriage return with a semicolon
string (REGEX REPLACE "[\r\n]+" ";" PROG_OUTPUT "${PROG_OUTPUT}")
endif () It runs for a bit until the compilation fails due to [401/3074] Building C object fortran\src\CMakeFiles\hdf5_f90cstub-shared.dir\H5_f.c.obj
FAILED: fortran/src/CMakeFiles/hdf5_f90cstub-shared.dir/H5_f.c.obj
%BUILD_PREFIX%\Library\bin\clang-cl.exe /nologo -DH5_BUILT_AS_DYNAMIC_LIB -D_BIND_TO_CURRENT_VCLIBS_VERSION=1 -D_CONSOLE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -Dhdf5_f90cstub_shared_EXPORTS -I%SRC_DIR%\src -I%SRC_DIR%\src\H5FDsubfiling -I%SRC_DIR%\build\src -I%SRC_DIR%\build\fortran -I%SRC_DIR%\build\fortran\shared -I%PREFIX%\Library\include -w /DWIN32 /D_WINDOWS /O2 /Ob2 /DNDEBUG -MD -Wall -Warray-bounds -Wcast-qual -Wconversion -Wdouble-promotion -Wextra -Wformat=2 -Wframe-larger-than=16384 -Wimplicit-fallthrough -Wnull-dereference -Wunused-const-variable -Wwrite-strings -Wpedantic -Wvolatile-register-var -Wno-c++-compat /W3 /wd4100 /wd4706 /wd4127 /showIncludes /Fofortran\src\CMakeFiles\hdf5_f90cstub-shared.dir\H5_f.c.obj /Fdfortran\src\CMakeFiles\hdf5_f90cstub-shared.dir\ -c -- %SRC_DIR%\fortran\src\H5_f.c
%SRC_DIR%\fortran\src\H5_f.c(187,16): error: use of undeclared identifier 'real_C_LONG_DOUBLE_f'
187 | if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(float)) {
| ^
%SRC_DIR%\fortran\src\H5_f.c(191,21): error: use of undeclared identifier 'real_C_LONG_DOUBLE_f'
191 | else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(double)) {
| ^
%SRC_DIR%\fortran\src\H5_f.c(196,21): error: use of undeclared identifier 'real_C_LONG_DOUBLE_f'
196 | else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) {
| ^
3 errors generated.
[402/3074] Building C object fortran\src\CMakeFiles\hdf5_f90cstub-shared.dir\H5Af.c.obj
[403/3074] Building C object fortran\src\CMakeFiles\hdf5_f90cstub-shared.dir\H5Df.c.obj
ninja: build stopped: subcommand failed.
Update: Okay, I think I solved it. Or at least I managed to get past the error message by adding the following to #ifndef real_C_LONG_DOUBLE_f
#define real_C_LONG_DOUBLE_f long double
#endif The next error is related to BIND(C) statements. Hm, are BIND(C) not supported by flang on windows?
Or maybe it's BIND(C) and the use of passing argument by value like so? subroutine mysub(x) bind(c)
integer, value :: x ! x is passed by value, not by reference
end subroutine mysub |
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( For recipe/meta.yaml:
|
The |
@h-vetinari Yup, it looks like it. I can raise an issue over at the llvm-project to see if it is on their radar. In the meantime to progress development on windows fortran support for hdf5 I opened #237 where I try to use the latest m2w64 libs. It looks quite promising from the local tests I did. |
@h-vetinari Seems like this is already fixed in the flang main branch (hopefully on track for v20). See llvm/llvm-project#114035 (comment). I'll try to test this asap. If it works, then we can consider issueing a pre-release of flang v20 on a non-main conda-forge label. |
This is a nontrivial effort (not extreme either, but it needs a strong reason to do it). I probably won't get around to doing it, but if you want, you can do the following:
You can expect this process to take at least a week (not work hours, but iterations to get things building and waiting for CI). I can help out if you're stuck somewhere, but that's about as much as I can promise for now. |
I thought I might give fortran support for windows a try here as well (seeing as we've had some success in adding fortran support on windows using flang in mumps, mgis, mfront).
However, it failed locally in my initial attempts on windows with
Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE
If that is not a quick fix, I can take the fortran support out and put it in a different PR.
Checklist
0
(if the version changed)conda-smithy
(Use the phrase@conda-forge-admin, please rerender
in a comment in this PR for automated rerendering)