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

Precompilation failure on Windows #11

Closed
moyner opened this issue Jan 7, 2023 · 14 comments
Closed

Precompilation failure on Windows #11

moyner opened this issue Jan 7, 2023 · 14 comments

Comments

@moyner
Copy link
Contributor

moyner commented Jan 7, 2023

Hi, thanks for writing this very nice wrapper for HYPRE! I have successfully used it on Linux environments but the package fails to precompile on Windows. I have tested with Julia 1.8.2, 1.8.3 and 1.8.4 from Juliaup on two different Windows 10 machines and get the same error message. The DLL mentioned (.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll) is present but cannot be loaded:

julia> using Libdl; Libdl.dlopen("C:\\Users\\olavm\\.julia\\artifacts\\fdf5fc024a09684b7e5c8759b433d7c332f20560\\bin\\liblapack.dll")
ERROR: could not load library "C:\Users\olavm\.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll"
The specified module could not be found.
Stacktrace:
 [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
   @ Base.Libc.Libdl .\libdl.jl:117
 [2] dlopen (repeats 2 times)
   @ .\libdl.jl:116 [inlined]
 [3] top-level scope
   @ REPL[17]:1

julia> isfile("C:\\Users\\olavm\\.julia\\artifacts\\fdf5fc024a09684b7e5c8759b433d7c332f20560\\bin\\liblapack.dll")
true

Full stacktrace from a clean environment:

julia> using HYPRE
[ Info: Precompiling HYPRE [b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771]
WARNING: method definition for async_exchange! at C:\Users\olavm\.julia\packages\PartitionedArrays\g9b74\src\Interfaces.jl:857 declares type variable Tsnd but does not use it.
ERROR: LoadError: InitError: could not load library "C:\Users\olavm\.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll"
The specified module could not be found.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl .\libdl.jl:116
  [3] macro expansion
    @ C:\Users\olavm\.julia\packages\JLLWrappers\QpMQW\src\products\library_generators.jl:54 [inlined]
  [4] __init__()
    @ LAPACK_jll C:\Users\olavm\.julia\packages\LAPACK_jll\RpBCX\src\wrappers\x86_64-w64-mingw32-libgfortran5.jl:10
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base .\loading.jl:831
  [6] _tryrequire_from_serialized(pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:978
  [7] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1347
  [8] _require_prelocked(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1200
  [9] macro expansion
    @ .\loading.jl:1180 [inlined]
 [10] macro expansion
    @ .\lock.jl:223 [inlined]
 [11] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1144
 [12] include(mod::Module, _path::String)
    @ Base .\Base.jl:419
 [13] top-level scope
    @ C:\Users\olavm\.julia\packages\JLLWrappers\QpMQW\src\toplevel_generators.jl:188
 [14] include
    @ .\Base.jl:419 [inlined]
 [15] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base .\loading.jl:1554
 [16] top-level scope
    @ stdin:1
during initialization of module LAPACK_jll
in expression starting at C:\Users\olavm\.julia\packages\HYPRE_jll\yO6KU\src\wrappers\x86_64-w64-mingw32-mpi+microsoftmpi.jl:5
in expression starting at C:\Users\olavm\.julia\packages\HYPRE_jll\yO6KU\src\HYPRE_jll.jl:2
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile HYPRE_jll [0a602bbd-b08b-5d75-8d32-0de6eef44785] to C:\Users\olavm\.julia\compiled\v1.8\HYPRE_jll\jl_4D16.tmp.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base .\loading.jl:1707
  [3] compilecache
    @ .\loading.jl:1651 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1200
  [6] macro expansion
    @ .\loading.jl:1180 [inlined]
  [7] macro expansion
    @ .\lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1144
  [9] include(mod::Module, _path::String)
    @ Base .\Base.jl:419
 [10] include(x::String)
    @ HYPRE.LibHYPRE C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\LibHYPRE.jl:1
 [11] top-level scope
    @ C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\LibHYPRE.jl:6
 [12] include(mod::Module, _path::String)
    @ Base .\Base.jl:419
 [13] include(x::String)
    @ HYPRE C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\HYPRE.jl:3
 [14] top-level scope
    @ C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\HYPRE.jl:15
 [15] include
    @ .\Base.jl:419 [inlined]
 [16] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base .\loading.jl:1554
 [17] top-level scope
    @ stdin:1
in expression starting at C:\Users\olavm\.julia\packages\HYPRE\8akxZ\lib\LibHYPRE.jl:1
in expression starting at C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\LibHYPRE.jl:1
in expression starting at C:\Users\olavm\.julia\packages\HYPRE\8akxZ\src\HYPRE.jl:3
in expression starting at stdin:1
ERROR: Failed to precompile HYPRE [b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771] to C:\Users\olavm\.julia\compiled\v1.8\HYPRE\jl_F0EB.tmp.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base .\loading.jl:1707
 [3] compilecache
   @ .\loading.jl:1651 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base .\loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base .\loading.jl:1200
 [6] macro expansion
   @ .\loading.jl:1180 [inlined]
 [7] macro expansion
   @ .\lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base .\loading.jl:1144
@fredrikekre
Copy link
Owner

Hi, I don't have access to a Windows machine right now, but the package passes test in Windows CI at least.

@giordano, since this look related to JLLs and MPI, perhaps you have any ideas?

@giordano
Copy link

giordano commented Jan 7, 2023

import Pkg
Pkg.add("DependencyWalker")
using HYPRE # this will fail as usual, it's OK
using DependencyWalker
Library(raw"C:\Users\olavm\.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll")

@moyner
Copy link
Contributor Author

moyner commented Jan 7, 2023

Ok, issue seems to be libblastrampoline-5-0-2.dll. I tried naïvely adding and loading the libblastrampoline_jll but no luck there.

julia> Library(raw"C:\Users\olavm\.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll")
◼ C:\Users\olavm\.julia\artifacts\fdf5fc024a09684b7e5c8759b433d7c332f20560\bin\liblapack.dll
  ◼ C:\WINDOWS\System32\msvcrt.dll
    ◼ C:\WINDOWS\System32\KERNELBASE.dll
  ✗ libblastrampoline-5-0-2.dll (NOT FOUND)
  ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libgfortran-5.dll
    ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libwinpthread-1.dll
      ◼ C:\WINDOWS\System32\msvcrt.dll
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\KERNEL32.DLL
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
    ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libgcc_s_seh-1.dll
      ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libwinpthread-1.dll
        ◼ C:\WINDOWS\System32\msvcrt.dll
          ◼ C:\WINDOWS\System32\KERNELBASE.dll
        ◼ C:\WINDOWS\System32\KERNEL32.DLL
          ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\msvcrt.dll
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\KERNEL32.DLL
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
    ◼ C:\WINDOWS\System32\msvcrt.dll
      ◼ C:\WINDOWS\System32\KERNELBASE.dll
    ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libquadmath-0.dll
      ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libgcc_s_seh-1.dll
        ◼ C:\Users\olavm\.julia\juliaup\julia-1.8.4+0.x64.w64.mingw32\bin\libwinpthread-1.dll
          ◼ C:\WINDOWS\System32\msvcrt.dll
            ◼ C:\WINDOWS\System32\KERNELBASE.dll
          ◼ C:\WINDOWS\System32\KERNEL32.DLL
            ◼ C:\WINDOWS\System32\KERNELBASE.dll
        ◼ C:\WINDOWS\System32\msvcrt.dll
          ◼ C:\WINDOWS\System32\KERNELBASE.dll
        ◼ C:\WINDOWS\System32\KERNEL32.DLL
          ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\msvcrt.dll
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\KERNEL32.DLL
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
    ◼ C:\WINDOWS\System32\ADVAPI32.dll
      ◼ C:\WINDOWS\System32\KERNEL32.DLL
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\RPCRT4.dll
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\msvcrt.dll
        ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\KERNELBASE.dll
      ◼ C:\WINDOWS\System32\sechost.dll
        ◼ C:\WINDOWS\System32\RPCRT4.dll
          ◼ C:\WINDOWS\System32\KERNELBASE.dll
    ◼ C:\WINDOWS\System32\KERNEL32.DLL
      ◼ C:\WINDOWS\System32\KERNELBASE.dll
  ◼ C:\WINDOWS\System32\KERNEL32.DLL
    ◼ C:\WINDOWS\System32\KERNELBASE.dll

@giordano
Copy link

giordano commented Jan 7, 2023

Yeah, libblastrampoline on Windows is a total minefield, I'm trying to fix it right in these days: JuliaLinearAlgebra/libblastrampoline#97.

For the time being we should simply not use libblastrampoline on Windows, but I can't do it right now because Yggdrasil CI is down.

@moyner
Copy link
Contributor Author

moyner commented Jan 7, 2023

That makes sense. I tried 1.6 which I think is pre-libblastrampoline being added and there HYPRE works fine on the same PC in a fresh environment. That maybe also explains why CI passes since that uses 1, 1.6 and latest.

@fredrikekre
Copy link
Owner

@giordano the PR you reference above is merged, whats the status of it getting into a Julia release?

@giordano
Copy link

JuliaLang/julia#47676 is in 1.9.0-beta4

@fredrikekre
Copy link
Owner

Great. @moyner perhaps you can try beta4?

@giordano
Copy link

We still need to rebuild the affected libraries though 🙂

@moyner
Copy link
Contributor Author

moyner commented Feb 19, 2023

We still need to rebuild the affected libraries though 🙂

Indeed, did a quick check and the same error occurs on beta4.

@moyner
Copy link
Contributor Author

moyner commented Apr 18, 2023

I bypassed this issue by using WSL for HYPRE.jl whenever I have to use Windows. Is there anything I can do to help rebuild the binaries? A related question is if the binaries could be built with OpenMP support (passing --with-openmp to configure) since it would allow multithreaded solves.

@giordano
Copy link

giordano commented May 6, 2023

Can anyone using Windows try this now with julia v1.9?

@moyner
Copy link
Contributor Author

moyner commented May 7, 2023

Can anyone using Windows try this now with julia v1.9?

Julia 1.9 RC3 on Windows 10 works! Thanks a lot!

  [b5ffcf37] HYPRE v1.4.0
  [0a602bbd] HYPRE_jll v2.23.1+1

Tests seem ok:

Test Summary: | Pass  Total  Time
LibHYPRE      |    2      2  0.0s
Test Summary: | Pass  Total  Time
HYPREMatrix   |    4      4  0.1s
Test Summary:                      | Pass  Broken  Total  Time
HYPREMatrix(::SparseMatrixCS(C|R)) |   29       2     31  1.8s
Test Summary:                | Pass  Total   Time
HYPREMatrix(::PSparseMatrix) |   17     17  19.4s
Test Summary: | Pass  Total  Time
HYPREVector   |    6      6  0.2s
Test Summary:         | Pass  Total  Time
HYPREVector(::Vector) |   19     19  0.1s
Test Summary:          | Pass  Total  Time
HYPREVector(::PVector) |   10     10  4.1s
Test Summary:                  | Pass  Total  Time
HYPRE(Matrix|Vector)?Assembler |   16     16  0.0s
Test Summary: | Pass  Total  Time
BiCGSTAB      |    8      8  3.6s
Test Summary: | Pass  Total  Time
BoomerAMG     |    7      7  0.0s
Test Summary: | Pass  Total  Time
FlexGMRES     |    7      7  0.2s
Test Summary: | Pass  Total  Time
GMRES         |    7      7  0.2s
Test Summary: | Pass  Total  Time
Hybrid        |    7      7  0.6s
Test Summary: | Pass  Total  Time
ILU           |    7      7  0.4s
Test Summary:     | Pass  Total  Time
(ParCSR)ParaSails |    4      4  0.2s
Test Summary: | Pass  Total  Time
(ParCSR)PCG   |    7      7  0.2s
Test Summary:                | Pass  Total  Time
solve with PartitionedArrays |    5      5  0.6s
Test Summary:                  | Pass  Total  Time
solve with SparseMatrixCS(C|R) |    2      2  0.0s
Test Summary: | Pass  Total  Time
MPI execution |    1      1  3.3s
     Testing HYPRE tests passed

@moyner moyner closed this as completed May 7, 2023
@fredrikekre
Copy link
Owner

Great, thanks @giordano for the rebuild, and @moyner for confirming the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants