Closed bsbhro closed 5 years ago
@bsbhro I don't explicitly include those targets. I see @zbeekman has been working a lot on CMake for opencoarrays, with several releases after the Ubuntu 18.10 version and as yet unreleased changes in https://github.com/sourceryinstitute/OpenCoarrays master.
The easiest solution for now for Ubuntu 18.10 may be to do as you have for now, and wait possible bug fixes. Perhaps open an issue in their repo to see if it's something they already know about, as they have since deprecated that ISO functionality and moved it to another repo.
Hi, Good Morning, I pulled and installed OpenCoarrays without any issues. I shortened their long cmake statement to 'cmake ..'. Thanks again!
Yes, for now ISO_Fortran_binding is no longer a requirement. Currently, ISO_Fortran_binding uses some VLAs, at least in the testing, which is not ideal. In the long run we would like to transition OpenCoarrays to using the standard conforming array descriptors provided in ISO_Fortran_binding for easing integration into other compilers beyond just GFortran. In the short term ISO_Fortran_binding is no longer a requirement.
As far as the change you had to make, this sounds like there was a typo in the 2.1.0 build files.
I shortened their long cmake statement to 'cmake ..'
Can you please let me know what the "long cmake statement" that you shortened was, and where you found it? We're always trying to simplify and improve our documentation. In general, a plain cmake ..
is fine. However, in practice, you may want/need to specify the C and Fortran compiler with the FC
and CC
environment variables, and the install prefix with -DCMAKE_INSTALL_PREFIX:PATH=/path/to/my/install/location
Also, did you install OpenCoarrays through apt-get install opencoarrays
? If so, and if 2.1.0 is the latest available version we can ping the debian package maintainer to see if he would be willing to update it to a more recent release.
@zbeekman : Hi, I cloned your OpenCoarrays-Repository and followed the (INSTALL.md) commands to build and install from source using CMake. There I wrote divergent 'cmake ..' It worked immediately. Thank you too!
@scivision I saw you made a lot changes. I pulled and built. All tests passed.
Hi @bsbhro perhaps try using the Ubuntu /usr opencoarrays 2.1 again. I now use the opencoarrays "imported target" . If that doesn't work, then as @zbeekman suggests the Ubuntu opencoarrays may need to be updated, as I did a very basic example under the coarray/ directory of this repo.
I don't know exactly what you mean. I reversed the change I commented. That didn't work like at the first try. I thougt so, because a file 'libcISO_Fortran_binding.a' doesn't exist. Back to my change it works. I think that my change to 'libISO_Fortran_binding.so.2.1.0' only eliminates the error message and cmake builds well. But this existing file is not linked. Now I make my change again :-) A mystery?
@scivision
I now use the opencoarrays "imported target"
FYI, I'm planning to have better/useable find_package(opencoarrays)
support in the near future. Next minor version bump, I hope.
@zbeekman it seems in the next year or so we would be ready to do a CMake merge request for a find_library(coarray)
that would cover OpenCoarrays and Intel Fortran's built in coarray, and whoever else needs special flags (Cray supports coarray without any flags needed for example)
@scivision My plan was to provide a package-config file from OpenCoarrays. I presume you're talking about integrating Coarray Support directly into CMake? I like that idea. My C++ is quite poor, but my CMake scripting abilities are pretty sharp. Perhaps we could collaborate on a PR to Kitware to get this supported natively in CMake?
I think it would be better to have CMake's language introspection for Fortran handle coarray capabilities. I'm not sure find_library()
would be the right approach. I would rather not write a "find module" for coarray support, but that may be the only option, we'll see.
I don't currently have access to NAG, or IBM compiler, only Intel, Cray, GNU, PGI, f18/flang.
Yes perhaps find_package(coarray)
is more correct. The idea I'm thinking of is to let the user know if their compiler version supports, and emit necessary flags, includes, libraries, imported targets.
This would be more generic than just strictly OpenCoarrays, for example for those compilers that just need a flag to enable built-in Fortran 2008 coarray support such as ifort
.
This would be done strictly with CMake script. I have a FindGnuOctave coming in next CMake release so I'm familiar with their merge process.
@zbeekman It was actually straightforward to write this: https://github.com/scivision/fortran2018-examples/blob/master/cmake/Modules/FindCoarray.cmake
What do you think?
Seperately, CMAKE_Fortran_KNOWN_FEATURES
for Fortran would be quite easy to present as are done for C++ in CMAKE_CXX_KNOWN_FEATURES.
example for random_init()
F2018 intrinsic:
check_fortran_source_compiles("program a; call random_init(); end"
f18random SRC_EXT f90)
That would be very nice. I've always thought about maintaining my own modules but it would be better to just add them all to CMake.
@scivision @zbeekman : I have to ask for forgiveness :-( I set up another notebook fresh with Ubuntu 18.10. After cloning your repositories I got some errors and as a last step I had to install 'libcoarrays-dev' ! Now I got the same message, see picture above. I think you thought so...
@zbeekman https://gitlab.kitware.com/cmake/cmake/merge_requests/2691 is what I've submitted to CMake for generic Fortran 2008 coarray support (native, flag, library)
@zbeekman CMake didn't want to add FindCoarray for generic coarray support yet because of the rapidly evolving coarray vendor landscape.
So perhaps Coarray enthusiasts could publicize and improve this generic FindCoarray.cmake
I think you may close this issue. I purged the Ubuntu opencoarrays package, installed OpenCoarrays from source and all works fine. Thanks again.
@scivision OpenCoarrays now supports find_package(OpenCoarrays)
fairly well.
cmake_minimum_required(VERSION 3.10)
cmake_policy(VERSION 3.10...3.14)
project(test_OC LANGUAGES Fortran C)
find_package(OpenCoarrays)
add_executable(tally tally.f90)
target_link_libraries(tally
PUBLIC OpenCoarrays::caf_mpi_static)
# Global property PACKAGES_FOUND
get_property(FoundPkgs GLOBAL
PROPERTY PACKAGES_FOUND)
message(STATUS "Packages found: ${FoundPkgs}")
# Directory property BUILDSYSTEM_TARGETS
get_directory_property(current_targets BUILDSYSTEM_TARGETS)
message(STATUS "Packages found: ${current_targets}")
# Get all propreties that cmake supports
execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)
# Convert command output into a CMake list
STRING(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
STRING(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
function(print_properties)
message ("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}")
endfunction(print_properties)
function(print_target_properties tgt)
if(NOT TARGET ${tgt})
message("There is no target named '${tgt}'")
return()
endif()
foreach (prop ${CMAKE_PROPERTY_LIST})
string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" prop ${prop})
# Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$")
continue()
endif()
# message ("Checking ${prop}")
get_property(propval TARGET ${tgt} PROPERTY ${prop} SET)
if (propval)
get_target_property(propval ${tgt} ${prop})
message ("${tgt} ${prop} = ${propval}")
endif()
endforeach(prop)
endfunction(print_target_properties)
print_target_properties(tally)
print_target_properties(OpenCoarrays::opencoarrays_mod)
print_target_properties(OpenCoarrays::caf_mpi)
print_target_properties(OpenCoarrays::caf_mpi_static)
Running this produces:
$ cmake -Wdev ..
-- The Fortran compiler identification is GNU 8.3.0
-- The C compiler identification is GNU 8.3.0
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Check for working Fortran compiler: /usr/local/bin/gfortran-8
-- Check for working Fortran compiler: /usr/local/bin/gfortran-8 -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/local/bin/gfortran-8 supports Fortran 90
-- Checking whether /usr/local/bin/gfortran-8 supports Fortran 90 -- yes
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/bin/gcc-8
-- Check for working C compiler: /usr/local/bin/gcc-8 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Packages found: OpenCoarrays
-- Packages found: tally
tally AUTOGEN_ORIGIN_DEPENDS = ON
tally AUTOMOC_COMPILER_PREDEFINES = ON
tally AUTOMOC_MACRO_NAMES = Q_OBJECT;Q_GADGET;Q_NAMESPACE
tally BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
tally BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
tally BUILD_WITH_INSTALL_RPATH = OFF
tally IMPORTED = FALSE
tally IMPORTED_GLOBAL = FALSE
tally INSTALL_RPATH =
tally INSTALL_RPATH_USE_LINK_PATH = OFF
tally INTERFACE_LINK_LIBRARIES = OpenCoarrays::caf_mpi_static
tally LINK_LIBRARIES = OpenCoarrays::caf_mpi_static
tally NAME = tally
tally OSX_ARCHITECTURES =
tally SKIP_BUILD_RPATH = OFF
tally SOURCES = tally.f90
tally SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
tally SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
tally TYPE = EXECUTABLE
tally TYPE = EXECUTABLE
OpenCoarrays::opencoarrays_mod AUTOGEN_ORIGIN_DEPENDS = ON
OpenCoarrays::opencoarrays_mod AUTOMOC_COMPILER_PREDEFINES = ON
OpenCoarrays::opencoarrays_mod AUTOMOC_MACRO_NAMES = Q_OBJECT;Q_GADGET;Q_NAMESPACE
OpenCoarrays::opencoarrays_mod BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::opencoarrays_mod BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::opencoarrays_mod BUILD_WITH_INSTALL_RPATH = OFF
OpenCoarrays::opencoarrays_mod IMPORTED = TRUE
OpenCoarrays::opencoarrays_mod IMPORTED_CONFIGURATIONS = RELEASE
OpenCoarrays::opencoarrays_mod IMPORTED_GLOBAL = FALSE
OpenCoarrays::opencoarrays_mod INSTALL_RPATH =
OpenCoarrays::opencoarrays_mod INSTALL_RPATH_USE_LINK_PATH = OFF
OpenCoarrays::opencoarrays_mod INTERFACE_INCLUDE_DIRECTORIES = $<$<COMPILE_LANGUAGE:Fortran>:/usr/local/Cellar/mpich/3.3/include>;/usr/local/include/OpenCoarrays-2.6.3_GNU-8.3.0
OpenCoarrays::opencoarrays_mod INTERFACE_LINK_LIBRARIES = -Wl,-flat_namespace -Wl,-commons,use_dylibs;/usr/local/Cellar/mpich/3.3/lib/libmpifort.dylib;/usr/local/Cellar/mpich/3.3/lib/libmpi.dylib;/usr/local/Cellar/mpich/3.3/lib/libpmpi.dylib;OpenCoarrays::caf_mpi_static
OpenCoarrays::opencoarrays_mod NAME = OpenCoarrays::opencoarrays_mod
OpenCoarrays::opencoarrays_mod OSX_ARCHITECTURES =
OpenCoarrays::opencoarrays_mod SKIP_BUILD_RPATH = OFF
OpenCoarrays::opencoarrays_mod SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::opencoarrays_mod SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::opencoarrays_mod TYPE = STATIC_LIBRARY
OpenCoarrays::opencoarrays_mod TYPE = STATIC_LIBRARY
OpenCoarrays::caf_mpi AUTOGEN_ORIGIN_DEPENDS = ON
OpenCoarrays::caf_mpi AUTOMOC_COMPILER_PREDEFINES = ON
OpenCoarrays::caf_mpi AUTOMOC_MACRO_NAMES = Q_OBJECT;Q_GADGET;Q_NAMESPACE
OpenCoarrays::caf_mpi BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::caf_mpi BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::caf_mpi BUILD_WITH_INSTALL_RPATH = OFF
OpenCoarrays::caf_mpi IMPORTED = TRUE
OpenCoarrays::caf_mpi IMPORTED_CONFIGURATIONS = RELEASE
OpenCoarrays::caf_mpi IMPORTED_GLOBAL = FALSE
OpenCoarrays::caf_mpi INSTALL_RPATH =
OpenCoarrays::caf_mpi INSTALL_RPATH_USE_LINK_PATH = OFF
OpenCoarrays::caf_mpi INTERFACE_COMPILE_OPTIONS = $<$<COMPILE_LANGUAGE:C>:>;$<$<COMPILE_LANGUAGE:Fortran>:-fcoarray=lib>
OpenCoarrays::caf_mpi INTERFACE_INCLUDE_DIRECTORIES = $<$<COMPILE_LANGUAGE:C>:/usr/local/Cellar/mpich/3.3/include>;/usr/local/include
OpenCoarrays::caf_mpi INTERFACE_LINK_LIBRARIES = -Wl,-flat_namespace -Wl,-commons,use_dylibs;/usr/local/Cellar/mpich/3.3/lib/libmpi.dylib;/usr/local/Cellar/mpich/3.3/lib/libpmpi.dylib
OpenCoarrays::caf_mpi NAME = OpenCoarrays::caf_mpi
OpenCoarrays::caf_mpi OSX_ARCHITECTURES =
OpenCoarrays::caf_mpi POSITION_INDEPENDENT_CODE = True
OpenCoarrays::caf_mpi SKIP_BUILD_RPATH = OFF
OpenCoarrays::caf_mpi SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::caf_mpi SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::caf_mpi TYPE = SHARED_LIBRARY
OpenCoarrays::caf_mpi TYPE = SHARED_LIBRARY
OpenCoarrays::caf_mpi_static AUTOGEN_ORIGIN_DEPENDS = ON
OpenCoarrays::caf_mpi_static AUTOMOC_COMPILER_PREDEFINES = ON
OpenCoarrays::caf_mpi_static AUTOMOC_MACRO_NAMES = Q_OBJECT;Q_GADGET;Q_NAMESPACE
OpenCoarrays::caf_mpi_static BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::caf_mpi_static BINARY_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
OpenCoarrays::caf_mpi_static BUILD_WITH_INSTALL_RPATH = OFF
OpenCoarrays::caf_mpi_static IMPORTED = TRUE
OpenCoarrays::caf_mpi_static IMPORTED_CONFIGURATIONS = RELEASE
OpenCoarrays::caf_mpi_static IMPORTED_GLOBAL = FALSE
OpenCoarrays::caf_mpi_static INSTALL_RPATH =
OpenCoarrays::caf_mpi_static INSTALL_RPATH_USE_LINK_PATH = OFF
OpenCoarrays::caf_mpi_static INTERFACE_COMPILE_OPTIONS = $<$<COMPILE_LANGUAGE:C>:>;$<$<COMPILE_LANGUAGE:Fortran>:-fcoarray=lib>
OpenCoarrays::caf_mpi_static INTERFACE_INCLUDE_DIRECTORIES = $<$<COMPILE_LANGUAGE:C>:/usr/local/Cellar/mpich/3.3/include>;/usr/local/include
OpenCoarrays::caf_mpi_static INTERFACE_LINK_LIBRARIES = -Wl,-flat_namespace -Wl,-commons,use_dylibs;/usr/local/Cellar/mpich/3.3/lib/libmpi.dylib;/usr/local/Cellar/mpich/3.3/lib/libpmpi.dylib
OpenCoarrays::caf_mpi_static NAME = OpenCoarrays::caf_mpi_static
OpenCoarrays::caf_mpi_static OSX_ARCHITECTURES =
OpenCoarrays::caf_mpi_static SKIP_BUILD_RPATH = OFF
OpenCoarrays::caf_mpi_static SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::caf_mpi_static SOURCE_DIR = /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj
OpenCoarrays::caf_mpi_static TYPE = STATIC_LIBRARY
OpenCoarrays::caf_mpi_static TYPE = STATIC_LIBRARY
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ibeekman/Sandbox/OpenCoarrays/test-client-proj/build
I hope you can use this either instead of your custom find module, or in conjunction with it.
I think it would be used in conjunction with FindCoarray.cmake, as the point of that higher-level script is to enable flags for compilers that have built-in support such as Intel, as well as address compilers that need OpenCoarrays
Yes. Just wanted to make you aware of the improvements and actual working functionality.
On Thu, Apr 11, 2019 at 8:11 PM Michael Hirsch, Ph.D. < notifications@github.com> wrote:
I think it would be used in conjunction with FindCoarray.cmake, as the point of that higher-level script is to enable flags for compilers that have built-in support such as Intel, as well as address compilers that need OpenCoarrays
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scivision/fortran2018-examples/issues/1#issuecomment-482382421, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREPJvY521amdOvNOS0OHs3ro0FlE0Xks5vf88wgaJpZM4YxedO .
I do use Ubuntu 18.10. I was only successful with cmake and 'make test' when I changed /usr/lib/x86_64-linux-gnu/cmake/opencoarrays/OpenCoarraysTargets-none.cmake at line 42 and 46 from 'libcISO_Fortran_binding.a' to 'libISO_Fortran_binding.so.2.1.0' Thank you for the stuff!