superlu_dist
superlu_dist copied to clipboard
Build issue with CMake using master with XSDK_ENABLE_Fortran=ON
This issue came up using spack to build superlu-dist@develop (as part of hypre's regression testing).
Here's the full build log spack-build-out.txt for spack install superlu-dist@develop
using linux-rhel7-sandybridge architecture with [email protected] and [email protected].
Here's a snippet:
/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:55: multiple definition of `__superlu_mod_MOD_set_supermatrix'
CMakeFiles/superlu_dist_fortran.dir/superlu_mod.f90.o:/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:55: first defined here
CMakeFiles/superlu_dist_fortran_mod.dir/superlu_mod.f90.o: In function `__superlu_mod_MOD_get_supermatrix':
/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:43: multiple definition of `__superlu_mod_MOD_get_supermatrix'
CMakeFiles/superlu_dist_fortran.dir/superlu_mod.f90.o:/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:43: first defined here
CMakeFiles/superlu_dist_fortran_mod.dir/superlu_mod.f90.o: In function `__superlu_mod_MOD_get_gridinfo':
/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:24: multiple definition of `__superlu_mod_MOD_get_gridinfo'
CMakeFiles/superlu_dist_fortran.dir/superlu_mod.f90.o:/tmp/osborn9/spack-stage/spack-stage-superlu-dist-develop-mzp5kkx3lgmr5oxxrctifrcsj6mxgdrf/spack-src/FORTRAN/superlu_mod.f90:24: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [FORTRAN/libsuperlu_dist_fortran.so.8.0.0] Error 1
The build was successful 5/21, but failed on 5/22 to help pinpoint.
Thanks!
@liuyangzhuan It seems my merged FORTRAN/CMakeLists.txt has some issues. Can you please take a look?
Hi, The problem is that when both superlu_dist_fortran and superlu_dist_fortran-static are built, they both depend on module files superlu_mod and superlupara, which causes the multiple definition issue when you do a parallel build (e.g., make -j4).
I just added a single line in FORTRAN/CMakeList.txt to enforce the compiling order superlu_dist_fortran-static and superlu_dist_fortran. You can give it a try using the latest commit, it should work now.
Thanks for the fix! -Sherry
On Tue, May 24, 2022 at 2:48 PM liuyangzhuan @.***> wrote:
Hi, The problem is that when both superlu_dist_fortran and superlu_dist_fortran-static are built, they both depend on module files superlu_mod and superlupara, which causes the multiple definition issue when you do a parallel build (e.g., make -j4).
I just added a single line in FORTRAN/CMakeList.txt to enforce the compiling order superlu_dist_fortran-static and superlu_dist_fortran. You can give it a try using the latest commit, it should work now.
— Reply to this email directly, view it on GitHub https://github.com/xiaoyeli/superlu_dist/issues/105#issuecomment-1136462923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZSV54ZM6WEEJW3KJGKKD3VLVFBBANCNFSM5WXU4JKA . You are receiving this because you commented.Message ID: @.***>
I've tried with commit 91c7fe1f78dce448b68f094dd6aa625c9667a0d3 but it's still failing
That's interesting. I'm wondering what could spack do differently than a standalone superlu install. I'm going to try spack myself and get back to you soon.
I'm not using spack but gentoo's cmake+ninja build system
@Alessandro-Barbieri What kind of error you are seeing?
@osborn9 Did this fix work for you?
https://dpaste.com/98L26Z7SX
set(mod_sources superlu_mod.f90 superlupara.f90)
set(sources
superlu_c2f_wrap.c # initialize precision-independent file
superlupara.f90
superlu_mod.f90
)
why are superlupara.f90
and superlu_mod.f90
in two different sets?
Hi, thanks for pointing this out. Indeed, this is causing the multiple definition error during compiling. I removed the mod_sources. Can you try the latest commit to see if this is fixed?
It didn't work
I would try this instead
# include the paths for header files
include_directories(${SuperLU_DIST_SOURCE_DIR}/SRC)
include_directories(${SuperLU_DIST_BINARY_DIR}/FORTRAN)
set(sources
superlu_c2f_wrap.c # initialize precision-independent file
superlupara.f90
superlu_mod.f90
)
if(enable_double)
list(APPEND sources c2f_dcreate_matrix_x_b.c superlu_c2f_dwrap.c)
endif()
if(enable_complex16)
list(APPEND sources c2f_zcreate_matrix_x_b.c superlu_c2f_zwrap.c)
endif()
add_library(superlu_dist_fortran_obj OBJECT ${sources})
add_library(superlu_dist_fortran $<TARGET_OBJECTS:superlu_dist_fortran_obj>)
add_library(superlu_dist_fortran-static STATIC $<TARGET_OBJECTS:superlu_dist_fortran_obj>)
# set(targets superlu_dist_fortran)
get_target_property(superlu_dist_version superlu_dist VERSION)
get_target_property(superlu_dist_soversion superlu_dist SOVERSION)
set_target_properties(superlu_dist_fortran PROPERTIES VERSION ${superlu_dist_version})
set_target_properties(superlu_dist_fortran PROPERTIES SOVERSION ${superlu_dist_soversion})
target_link_libraries(superlu_dist_fortran superlu_dist)
set_target_properties(superlu_dist_fortran-static PROPERTIES OUTPUT_NAME superlu_dist_fortran)
set_target_properties(superlu_dist_fortran-static PROPERTIES VERSION ${superlu_dist_version})
set_target_properties(superlu_dist_fortran-static PROPERTIES SOVERSION ${superlu_dist_soversion})
target_link_libraries(superlu_dist_fortran-static superlu_dist)
I would try this instead
# include the paths for header files include_directories(${SuperLU_DIST_SOURCE_DIR}/SRC) include_directories(${SuperLU_DIST_BINARY_DIR}/FORTRAN) set(sources superlu_c2f_wrap.c # initialize precision-independent file superlupara.f90 superlu_mod.f90 ) if(enable_double) list(APPEND sources c2f_dcreate_matrix_x_b.c superlu_c2f_dwrap.c) endif() if(enable_complex16) list(APPEND sources c2f_zcreate_matrix_x_b.c superlu_c2f_zwrap.c) endif() add_library(superlu_dist_fortran_obj OBJECT ${sources}) add_library(superlu_dist_fortran $<TARGET_OBJECTS:superlu_dist_fortran_obj>) add_library(superlu_dist_fortran-static STATIC $<TARGET_OBJECTS:superlu_dist_fortran_obj>) # set(targets superlu_dist_fortran) get_target_property(superlu_dist_version superlu_dist VERSION) get_target_property(superlu_dist_soversion superlu_dist SOVERSION) set_target_properties(superlu_dist_fortran PROPERTIES VERSION ${superlu_dist_version}) set_target_properties(superlu_dist_fortran PROPERTIES SOVERSION ${superlu_dist_soversion}) target_link_libraries(superlu_dist_fortran superlu_dist) set_target_properties(superlu_dist_fortran-static PROPERTIES OUTPUT_NAME superlu_dist_fortran) set_target_properties(superlu_dist_fortran-static PROPERTIES VERSION ${superlu_dist_version}) set_target_properties(superlu_dist_fortran-static PROPERTIES SOVERSION ${superlu_dist_soversion}) target_link_libraries(superlu_dist_fortran-static superlu_dist)
It worked (!)
It worked (!)
Same for me (most recent commit removing mod_sources. ). Thanks @liuyangzhuan!
This is my patch https://gist.github.com/Alessandro-Barbieri/1141ce90306112a3926f1345fb244580
It worked (!)
Same for me (most recent commit removing mod_sources. ). Thanks @liuyangzhuan!
Are you sure? The latest commit didn't work for me
It worked (!)
Same for me (most recent commit removing mod_sources. ). Thanks @liuyangzhuan!
Are you sure? The latest commit didn't work for me
Yes. Note I'm installing via spack (but uses CMake build).
spack install superlu-dist@develop
==> No binary for superlu-dist-develop-bw74jjrdz4fsckybnopr5r74dtu3jlad found: installing from source
==> No patches needed for superlu-dist
==> superlu-dist: Executing phase: 'cmake'
==> superlu-dist: Executing phase: 'build'
==> superlu-dist: Executing phase: 'install'
==> superlu-dist: Successfully installed superlu-dist-develop-bw74jjrdz4fsckybnopr5r74dtu3jlad
I was using ninja and 12 make jobs