Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildtools for compiling dart as a library #702

Merged
merged 9 commits into from
Jul 26, 2024
Merged

Buildtools for compiling dart as a library #702

merged 9 commits into from
Jul 26, 2024

Conversation

hkershaw-brown
Copy link
Member

@hkershaw-brown hkershaw-brown commented Jul 16, 2024

Description:

Buildtools for compiling dart as a library (libdart.a or libdart.so)

SiParCS 2024 Anh Pham and Suman Shekhar students used dart as a static library.
There are other people interested in having dart as a library, so this provides buildtools so they don't have to create Makefiles by hand.

This pull request has a developer test directory 'library' which has a shared lib build and a static lib build and a little test script to demo building and linking filter.

Not sure what level of docs to add, maybe just a section in DART build system for people who want to play with a library.

Fixes issue

no issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

DART/developer_tests/library/test_libraries.sh does a bitwise test for filter (regular build vs. static library vs shared library)
edit: also did a paranoia check that -fPIC was bitwise for a regular build of filter.

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

developer test builds dart as a static library
library is libdart.a
quickbuild.sh clean removes libdart.a rather than *.a since we do not want to remove
any other static libaries some has built
assumes library is called libdart.so
@hkershaw-brown hkershaw-brown requested a review from mjs2369 July 18, 2024 16:44
@mjs2369
Copy link
Contributor

mjs2369 commented Jul 19, 2024

@hkershaw-brown I'm getting some errors when running test_libraries.sh

/glade/derecho/scratch/masmith/DART/assimilation_code/modules/utilities/mpi_utilities_mod.f90(1862): error #6404: This name does not have a type, and must have an explicit type.   [SYSTEM]
    rc = system(trim(shell_name)//' '//trim(execute)//' '//char(0))
---------^
/glade/derecho/scratch/masmith/DART/assimilation_code/modules/utilities/mpi_utilities_mod.f90(2033): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [MPI_UTILITIES_MOD]
 use mpi_utilities_mod, only : get_dart_mpi_comm
-----^

I'll keep looking into these, but I thought I'd let you know now to see if you might already know the causes.

@hkershaw-brown
Copy link
Member Author

hkershaw-brown commented Jul 19, 2024

@mjs2369 are you running with a gfortran mkmf.template but the intel module on Derecho?

@mjs2369
Copy link
Contributor

mjs2369 commented Jul 19, 2024

@mjs2369 are you running with a gfortran mkmf.template but the intel module on Derecho?

Yep, duh. Though I did have to add the mpif08 argument to lines that run quickbuild (22, 36, and 44) in test_libraries.sh to get it compile with gfortran. But the script is still erroring out while trying to run filter for the first time on line 62 (the no lib build):

ar: creating libdart.a
a - algorithm_info_mod.o
a - bnrh_distribution_mod.o
a - netcdf_utilities_mod.o
a - schedule_mod.o
a - io_filenames_mod.o
.... (a bunch more files)
a - direct_netcdf_mod.o
a - distribution_params_mod.o
a - assert_mod.o
No host list provided

I haven't been able to figure out why this is happening yet

@mjs2369
Copy link
Contributor

mjs2369 commented Jul 19, 2024

Some last questions/comments other than the error are:

  1. I think minimal docs in the like you mentioned in the body of the PR sound like the way to go, but I think they might make more sense in Compiling DART instead of "DART Build System".

  2. We aren't supporting compiling DART as a library for Windows, right? The mkmf.template.gfortran is only for osx and linux, and I believe that Windows uses different file extensions for library files (static libraries are .lib in Windows instead of .a)

@hkershaw-brown
Copy link
Member Author

hkershaw-brown commented Jul 22, 2024

ar: creating libdart.a
a - algorithm_info_mod.o
a - bnrh_distribution_mod.o
a - netcdf_utilities_mod.o
a - schedule_mod.o
a - io_filenames_mod.o
.... (a bunch more files)
a - direct_netcdf_mod.o
a - distribution_params_mod.o
a - assert_mod.o
No host list provided

I haven't been able to figure out why this is happening yet

Are you trying to run an mpi job on the Derecho login nodes?

@hkershaw-brown
Copy link
Member Author

Some last questions/comments other than the error are:

  1. I think minimal docs in the like you mentioned in the body of the PR sound like the way to go, but I think they might make more sense in Compiling DART instead of "DART Build System".

So this isn't a feature for general use. It would be for people developing tools that use DART. I think the build system docs (developers section) is the place for it.

  1. We aren't supporting compiling DART as a library for Windows, right? The mkmf.template.gfortran is only for osx and linux, and I believe that Windows uses different file extensions for library files (static libraries are .lib in Windows instead of .a)

No we're not supporting DART as a library for windows. If people want to use DART on windows, then I'd recommend using WSL.

@hkershaw-brown
Copy link
Member Author

hkershaw-brown commented Jul 22, 2024

@hkershaw-brown mpif90 mpif08

Copy link
Contributor

@mjs2369 mjs2369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good; the library builds and developer test to check that they are bitwise work well. Approved

@hkershaw-brown hkershaw-brown added the release! bundle with next release label Jul 25, 2024
@hkershaw-brown hkershaw-brown merged commit 75cf8dc into main Jul 26, 2024
4 checks passed
@hkershaw-brown hkershaw-brown deleted the libdart branch July 26, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release! bundle with next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants