complexphoton / MESTI.jl

3D multi-source electromagnetic simulations in frequency domain, implementing the augmented partial factorization (APF) and other methods.
GNU General Public License v3.0
34 stars 3 forks source link

MUMPS compilation on WSL #5

Closed YumingN closed 2 weeks ago

YumingN commented 2 months ago

Hi there,

I am having a hard time compiling the MUMPS (5.7.3) package on Windows 11 following the guide. I have installed metis-5.1.0, Intel Base Toolkit, and Intel HPC Toolkit. It seems that mpiicc is no longer available, so I am using mpiicx and mpiifx in the Makefile.inc. Now I got stuck during compilation, and I kept getting error with ld about undefined reference when running mpiifx:

...
make[2]: Entering directory '/home/yuming-wsl/MUMPS_5.7.3/src'
...
mpiifx -O -nofor-main -qopenmp  mumps_pivnul_mod.o ana_omp_m.o ana_blk_m.o ana_orderings_wrappers_m.o double_linked_list.o fac_asm_build_sort_index_ELT_m.o fac_asm_build_sort_index_m.o fac_descband_data_m.o fac_future_niv2_mod.o fac_ibct_data_m.o fac_maprow_data_m.o front_data_mgt_m.o lr_common.o mumps_comm_ibcast.o mumps_l0_omp_m.o mumps_memory_mod.o mumps_mpitoomp_m.o mumps_ooc_common.o sol_ds_common_m.o mumps_static_mapping.o omp_tps_common_m.o ana_blk.o ana_orderings.o ana_set_ordering.o ana_AMDMF.o bcast_errors.o estim_flops.o mumps_type2_blocking.o mumps_version.o mumps_print_defined.o mumps_addr.o mumps_common.o mumps_pord.o mumps_metis.o mumps_metis64.o mumps_metis_int.o mumps_scotch.o mumps_scotch64.o mumps_scotch_int.o mumps_io.o mumps_io_basic.o mumps_io_thread.o mumps_io_err.o mumps_numa.o mumps_thread.o mumps_save_restore_C.o mumps_config_file_C.o mumps_thread_affinity.o mumps_register_thread.o tools_common.o sol_common.o -Wl,-soname,libmumps_common.so -L../lib -Wl,-rpath,/home/yuming-wsl/MUMPS_5.7.3/lib/ -L/usr/local/lib -lmetis -L../PORD/lib/ -lpord  -L/opt/intel/oneapi/mkl/2024.2/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -L/opt/intel/oneapi/mkl/2024.2/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -o ../lib/libmumps_common.so 
ld: /opt/intel/oneapi/compiler/2024.2/lib/libifcoremt.a(for_main.o): in function `main':
for_main.c:(.text+0x28): undefined reference to `MAIN__'
...

Similar error occurs when I try icx and ifx/mpiifort/ifort.

The Makefile.inc and its corresponding output message areattached.

Any help would greatly appreciated!

output.txt Makefile.inc.txt

LKYsaeooi commented 1 month ago

Hi, I met the same problem. I solve this problem by modifying the Makefile.inc based on the "Makefile.INTEL.PAR" inside subfolder of MUMPS unzipped folder "...\MUMPS_5.7.1\Make.inc". My Makefile is attached. Hope it can be helpful. Makefile.inc.txt

YumingN commented 2 weeks ago

Thank you so much! It seems that the installation is completed after I changed the CC to mpiicx. But then, I ran into a different problem: In MUMPS Installation instruction, it asks me to export LD_PRELOAD=$LD_PRELOAD:/opt/intel/oneapi/inspector/latest/lib64/libiomp5.so But the inspector folder does not exist (I installed Intel Base Toolkit, Intel HPC Toolkit using Linux online commandline installer). So I tried to use existing libiomp5.so files in the oneapi folder, and I also tried to remove it. No error is reported.

In the end, when running the MESTI test files, at I got the error:

   could not load library "~/MUMPS_5.7.3/lib/libsmumps"
  ~/MUMPS_5.7.3/lib/libsmumps.so: cannot open shared object file: No such file or directory

The complete command-line message is below:

yuming-wsl@DESKTOP-JJAP6PM:~/MESTI/MESTI.jl-main/test$ julia runtests.jl
matrix_solver:          : Error During Test at /home/yuming-wsl/MESTI/MESTI.jl-main/test/matrix_solver_test.jl:7
  Got exception outside of a @test
  could not load library "~/MUMPS_5.7.3/lib/libsmumps"
  ~/MUMPS_5.7.3/lib/libsmumps.so: cannot open shared object file: No such file or directory
  Stacktrace:
    [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
      @ Base.Libc.Libdl ./libdl.jl:117
    [2] dlopen
      @ ./libdl.jl:116 [inlined]
    [3] dlopen(s::String)
      @ Base.Libc.Libdl ./libdl.jl:116
    [4] invoke_mumps_unsafe!
      @ ~/.julia/packages/MESTI/l6EWV/src/mumps3_interface.jl:36 [inlined]
    [5] (Mumps{Float32})(sym::Int64, par::Int64, comm::Int64)
      @ MESTI ~/.julia/packages/MESTI/l6EWV/src/mumps3_struc.jl:131
    [6] #_#8
      @ ~/.julia/packages/MESTI/l6EWV/src/mumps3_convenience_wrappers.jl:33 [inlined]
    [7] Mumps(A::SparseMatrixCSC{Float32, Int64}; kwargs::@Kwargs{sym::Int64, par::Int64})
      @ MESTI ~/.julia/packages/MESTI/l6EWV/src/mumps3_convenience_wrappers.jl:42
    [8] MUMPS_analyze_and_factorize(A::SparseMatrixCSC{Float64, Int64}, opts::Opts, is_symmetric::Bool, ind_schur::Nothing, par::Int64)
      @ MESTI ~/.julia/packages/MESTI/l6EWV/src/mesti_matrix_solver.jl:979
    [9] MUMPS_analyze_and_factorize (repeats 2 times)
      @ ~/.julia/packages/MESTI/l6EWV/src/mesti_matrix_solver.jl:958 [inlined]
   [10] mesti_matrix_solver!(matrices::Matrices, opts::Opts)
      @ MESTI ~/.julia/packages/MESTI/l6EWV/src/mesti_matrix_solver.jl:771
   [11] macro expansion
      @ ~/MESTI/MESTI.jl-main/test/matrix_solver_test.jl:16 [inlined]
   [12] macro expansion
      @ ~/.julia/juliaup/julia-1.10.5+0.x64.linux.gnu/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
   [13] top-level scope
      @ ~/MESTI/MESTI.jl-main/test/matrix_solver_test.jl:8
   [14] include(fname::String)
      @ Base.MainInclude ./client.jl:489
   [15] top-level scope
      @ ~/MESTI/MESTI.jl-main/test/runtests.jl:5
   [16] include(mod::Module, _path::String)
      @ Base ./Base.jl:495
   [17] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:318
   [18] _start()
      @ Base ./client.jl:552
Test Summary:            | Error  Total  Time
matrix_solver:           |     1      1  1.1s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /home/yuming-wsl/MESTI/MESTI.jl-main/test/matrix_solver_test.jl:7
in expression starting at /home/yuming-wsl/MESTI/MESTI.jl-main/test/runtests.jl:5

Thanks in advance for any help!

LKYsaeooi commented 2 weeks ago

Hi, It seems that the structure of Installation folder of lastest verion of oneapi is different from the previous one. So I change the command given by the instruction using my path of libiomp5.so. For me, the command is: export LD_PRELOAD=$LD_PRELOAD:/opt/intel/oneapi/2024.2/lib/libiomp5.so Besides, I add all the command having "export" and "source" in the .bashrc file to ensure that corresponding commands can be run everytime I open the subsustem by: cd nano ~/.bashrc Then adding the commands behind the file: 微信截图_20241005104626 It may solve the issue of cannot finding folders or files. For the question of: could not load library "~/MUMPS_5.7.3/lib/libsmumps" ~/MUMPS_5.7.3/lib/libsmumps.so: cannot open shared object file: No such file or directory Does the corresponding files existing in the lib foler just like the following image?

image If it doesn't, maybe the compilation procedure has unseen error.

YumingN commented 2 weeks ago

Hi there,

Thank you so much for the advice! I did tried /opt/intel/oneapi/2024.2/lib/libiomp5.so, and I got no error. I do have all the .so files in lib folder.

I just figured out: It seems that it cannot recognize "~" in the path in startup.jl. I changed it to the full path, and then it runs!

Cheers!