Fortran 90 bindings
Created by: williamfgc
Merge request reports
Activity
Created by: williamfgc
@chuckatkins I need you help as the Fortran test and example fail on Mac when MPI is enabled, it also creates the hello_bpWriter_f.dSYM directory under bin. Everything works fine on my Ubuntu box. See below:
$ ./bin/hello_bpWriter_f dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/6/libgfortran.3.dylib Referenced from: /usr/local/opt/open-mpi/lib/libmpi_usempif08.20.dylib Reason: image not found Trace/BPT trap: 5
Thanks!
157 162 message("") 158 163 message("ADIOS2 build configuration:") 159 164 message(" ADIOS Version: ${ADIOS2_VERSION}") 160 message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} ${CMAKE_CXX_COMPILER_WRAPPER}") 165 message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} " 166 "${CMAKE_CXX_COMPILER_VERSION} " 167 "${CMAKE_CXX_COMPILER_WRAPPER}") 161 168 message(" ${CMAKE_CXX_COMPILER}") 162 169 message("") Created by: chuckatkins
Let's add another line here do show the fortran compiler information:
if(ADIOS2_HAVE_Fortran) message(" Fortran Compiler : ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION} ${CMAKE_Fortran_COMPILER_WRAPPER}") message(" ${CMAKE_Fortran_COMPILER}") endif()
10 adios2_adios_mod.f90 11 adios2_io_mod.f90 12 adios2_engine_mod.f90 13 adios2_engine_write_mod.f90 14 adios2_functions_mod.f90 15 adios2_f2c.cpp ) 16 17 if(ADIOS2_HAVE_MPI) 18 add_library(adios2_f ${adios2_f_common} 19 mpi/adios2_adios_init_mod.f90 20 mpi/adios2_io_open_mod.f90 ) 21 else() 22 add_library(adios2_f ${adios2_f_common} 23 nompi/adios2_adios_init_nompi_mod.f90 24 nompi/adios2_io_open_nompi_mod.f90 ) 25 endif() Created by: chuckatkins
Rather than build the list of source files, go ahead and explicitly add them:
add_library(adios2_f adios2_mod.f90 ... adios2_f2c.cpp ) if(ADIOS2_HAVE_MPI) target_sources(adios2_f PRIVATE mpi/adios2_adios_init_mod.f90 mpi/adios2_io_open_mod.f90 ) else() target_sources(adios2_f PRIVATE nompi/adios2_adios_init_nompi_mod.f90 nompi/adios2_io_open_nompi_mod.f90 ) endif()
26 26 } adios2_constant_dims; 27 27 28 28 typedef enum { 29 adios2_type_string, 30 29 31 adios2_type_char, 30 adios2_type_char = 0, 3 ! accompanying file Copyright.txt for details. 4 ! 5 ! adios2_engine_write_mod.f90 : ADIOS2 Fortran bindings for Engine generic 6 ! Write functions 7 ! 8 ! Created on: Aug 22, 2017 9 ! Author: William F Godoy godoywf@ornl.gov 10 ! 11 module adios2_engine_write 12 13 interface adios2_write 14 15 ! Single Value 16 module procedure adios2_write_integer 17 module procedure adios2_write_real 18 module procedure adios2_write_dp 6 if(NOT ADIOS2_HAVE_MPI) 7 add_executable(TestBPWriteTypes_f TestBPWriteTypes_nompi.f90 8 SmallTestData_mod.f90) 9 target_link_libraries(TestBPWriteTypes_f adios2_f adios2) 10 endif() 11 12 if(ADIOS2_HAVE_MPI) 13 add_executable(TestBPWriteTypes_f TestBPWriteTypes.f90 SmallTestData_mod.f90) 14 target_include_directories(TestBPWriteTypes_f PRIVATE 15 ${MPI_Fortran_INCLUDE_PATH} 16 ${MPI_C_INCLUDE_PATH}) 17 target_link_libraries(TestBPWriteTypes_f adios2_f adios2 18 ${MPI_Fortran_LIBRARIES} 19 ${MPI_C_LIBRARIES}) 20 endif() 21 Created by: chuckatkins
Try consolidating a bit:
add_executable(TestBPWriteTypes_f SmallTestData_mod.f90) if(ADIOS2_HAVE_MPI) target_sources(TestBPWriteTypes_f PRIVATE TestBPWriteTypes.f90) else() target_sources(TestBPWriteTypes_f PRIVATE TestBPWriteTypes_nompi.f90) target_include_directories(TestBPWriteTypes_f PRIVATE ${MPI_Fortran_INCLUDE_PATH}) target_link_libraries(TestBPWriteTypes_f PRIVATE ${MPI_Fortran_LIBRARIES}) endif() target_link_libraries(TestBPWriteTypes_f PRIVATE adios2_f)
3 ! accompanying file Copyright.txt for details. 4 ! 5 ! adios2_engine_write_mod.f90 : ADIOS2 Fortran bindings for Engine generic 6 ! Write functions 7 ! 8 ! Created on: Aug 22, 2017 9 ! Author: William F Godoy godoywf@ornl.gov 10 ! 11 module adios2_engine_write 12 13 interface adios2_write 14 15 ! Single Value 16 module procedure adios2_write_integer 17 module procedure adios2_write_real 18 module procedure adios2_write_dp Created by: williamfgc
Sadly,
real*8
is non-standard (even though it's everywhere), and kind=8 is not guaranteed to be 8 bytes (although most compilers do), the preferred way in Fortran 90 is using a dp parameter: https://web.stanford.edu/class/me200c/tutorial_90/04_basic.html http://fortranwiki.org/fortran/show/Real+precision . Also, compilers allow complex*16 as being equal to complex(kind=8) http://earth.uni-muenster.de/~joergs/doc/f90/unix-um/dfum_035.html confusing, isn't it?
26 26 } adios2_constant_dims; 27 27 28 28 typedef enum { 29 adios2_type_string, 30 29 31 adios2_type_char, 30 adios2_type_char = 0, 157 162 message("") 158 163 message("ADIOS2 build configuration:") 159 164 message(" ADIOS Version: ${ADIOS2_VERSION}") 160 message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} ${CMAKE_CXX_COMPILER_WRAPPER}") 165 message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} " 166 "${CMAKE_CXX_COMPILER_VERSION} " 167 "${CMAKE_CXX_COMPILER_WRAPPER}") 161 168 message(" ${CMAKE_CXX_COMPILER}") 162 169 message("")