NCAR/geocat-f2py

Add Makefile or similar to contain Fortran .so file generation codes

erogluorhan opened this issue · 1 comments

It is not urgent for now but a Makefile or similar structure should be added to the repo once we make all of our unit tests pass and decide to add geocat-f2py under geocat-comp. This is because:

Github repo should have the following shape:

  • INCLUDES:
    • Fortran files (.f),
    • f2py Header files (.pyf),
    • Makefile or similar that contains f2py -c commands to generate .so shared object files for Fortran files.
  • DOES NOT INCLUDE:
    • .so files because these files are generated depending on the local system configuration

So, the developer's workflow for wrapping Fortran files should be as follows:

  1. Picks a single function or functions family, copies its Fortran file into the corresponding directory, generates the .pyf header file with the help of following command:
    f2py <fortran_filename>.f -m <target_module_name> -h <desired_header_file_name>.pyf

    Should add the generated .pyf file into Github commits.

  2. Generates .so file using the command:

    f2py -c <header_file_name>.pyf <fortran_file_name>.f

    Should NOT add the generated .so file to the Github commits.

  3. Implements the wrapper for function(s). Adds these implementations to Github commits.

  4. Adds unit tests under test/directory and makes sure the implementation passes all necessary (different data types, input-output content, parallelization, etc.) tests.

    Adds these tests to Github commits.

Done, build.sh