[CMake] CMake and MPIF90
Thompson, K T
kgt at lanl.gov
Fri Apr 26 11:37:20 EDT 2013
Hi Lucas,
Since you can build this code manually, try running 'make VERBOSE=1' from your CMake-based build and compare the flags and options that are used by CMake vs. what you would do w/o CMake. This exercise should give you enough information to get the CMake-based build working by modifying CMAKE_Fortran_FLAGS, using add_definitions(), etc.
FWIW - In my project, we don't use mpif90. Instead, we manually specify the MPI libraries that need to be linked. Something like this:
add_executable( foo_exe foo.f90 )
target_link_libraries( foo_exe ${MPI_Fortran_LIBRARIES} )
set_target_properties( foo_exe PROPERTIES
LINKER_LANGUAGE Fortran
OUTPUT_NAME foo )
-kt
---
Kelly Thompson
> -----Original Message-----
> From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of
> Pettey . Lucas
> Sent: Thursday, April 25, 2013 3:11 PM
> To: cmake at cmake.org
> Subject: [CMake] CMake and MPIF90
>
> Hello,
>
> I am getting errors when I execute a simple "hello World" mpi program
> compiled using cmake.
>
> I could not get the program to compile using various forms of
> FIND_PACKAGE(MPI REQUIRED), INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH}),
> TARGET_LINK_LIBRARIES(executable ${MPI_LIBRARIES}) and filling in flags
> manually for anything missing.
>
> I then tried FC=mpif90 and the program compiled, but gave me upon execution
> a series of errors starting with:
>
> [[INVALID],INVALID] ORTE_ERROR_LOG: Not found in file runtime/orte_init.c at
> line 121
>
> The rest indicate that MPI is not being initialized properly.
>
> As a sanity check, I compiled using mpif90 in the command line and
> everything worked fine.
>
> Any ideas or links to documentation? I tried searching the wiki, but it is
> not very straightforward.
>
> Thanks,
> Lucas
> ________________________________
> This electronic message transmission and any attachments that accompany it
> contain information from DRC(r) (Dynamics Research Corporation) or its
> subsidiaries, or the intended recipient, which is privileged, proprietary,
> business confidential, or otherwise protected from disclosure and is the
> exclusive property of DRC and/or the intended recipient. The information in
> this email is solely intended for the use of the individual or entity that
> is the intended recipient. If you are not the intended recipient, any use,
> dissemination, distribution, retention, or copying of this communication,
> attachments, or substance is prohibited. If you have received this
> electronic transmission in error, please immediately reply to the author via
> email that you received the message by mistake and also promptly and
> permanently delete this message and all copies of this email and any
> attachments. We thank you for your assistance and apologize for any
> inconvenience.
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list