Skip to content
Snippets Groups Projects

Fortran 90 bindings

Merged Podhorszki, Norbert requested to merge github/fork/williamfgc/f90_bindings into master

Created by: williamfgc

Merge request reports

Merged by avatar (Mar 27, 2025 11:14am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 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!

  • Created by: williamfgc

    This is also ready to go. Needed to resolve conflicts after merging with master.

  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
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()
  • Podhorszki, Norbert
  • Podhorszki, Norbert
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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()
  • Podhorszki, Norbert
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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,
    • Created by: chuckatkins

      Is there a compelling reason to give the enums explicit values rather than just let it be automatic? If so, they should all get them, not just this half.

  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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: chuckatkins

      W.R.T to naming conventions, rather than dp for double precision, would it be more appropriate to use the real8 fortran convention? i.e.

      ...
      adios2_write_real
      adios2_write_real8
      ...
      adios2_write_complex
      adios2_write_complex8
      ...
  • Podhorszki, Norbert
  • Podhorszki, Norbert
  • Podhorszki, Norbert
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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)
  • Podhorszki, Norbert
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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,
    • Created by: williamfgc

      Good catch. Fortran integer parameter types must match the C enum ones. I can refactor it on the Fortran-C glue code with a switch to leave the C side untouched, but it would add another if else-if.

  • Podhorszki, Norbert
  • Podhorszki, Norbert
  • Podhorszki, Norbert
  • Podhorszki, Norbert
    Podhorszki, Norbert @pnb started a thread on commit e40fba7e
  • 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("")
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading