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

Build Fortran interface: autotools & CMake #1255

Merged
merged 60 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d8d9343
Change Makefile for fortran_interface.f90
chiaraMaHe Jul 24, 2024
adbef22
add t8_mo_fortran_interface.f90
chiaraMaHe Jul 24, 2024
1eb7cea
Add t8_fortran_specific.mk
chiaraMaHe Jul 24, 2024
d8a1300
Add first fortran interface file
chiaraMaHe Jul 24, 2024
f1f7e4c
Add auto-build for fortran
chiaraMaHe Jul 24, 2024
f5128c7
Add empty fortran file
chiaraMaHe Jul 24, 2024
e467b8a
Add fortran configure file
chiaraMaHe Jul 24, 2024
0cf9128
Add missing header file
chiaraMaHe Jul 24, 2024
addf7fb
config file not needed
chiaraMaHe Jul 24, 2024
709a71b
Correct typo
chiaraMaHe Jul 24, 2024
1bfa267
Add functions in interface
chiaraMaHe Jul 29, 2024
3a82d39
Merge branch 'main' into fortran-build
chiaraMaHe Jul 30, 2024
d28301b
Merge branch 'main' into fortran-build
chiaraMaHe Jul 30, 2024
30afa27
Resolve merge conflict
chiaraMaHe Jul 30, 2024
cf0d397
Merge branch 'main' into fortran-interface
chiaraMaHe Jul 30, 2024
472bb88
add api testfile
sandro-elsweijer Aug 12, 2024
80d806a
add api tests to workflow
sandro-elsweijer Aug 12, 2024
c7e8761
Merge branch 'main' into fortran-build
chiaraMaHe Aug 12, 2024
da5132d
Indentation
chiaraMaHe Aug 12, 2024
035bbb9
Merge branch 'main' into fortran-interface
chiaraMaHe Aug 12, 2024
44195db
Merge branch 'main' into fortran-build
holke Aug 13, 2024
c49f9f3
Add some comments
holke Aug 13, 2024
ea58a7d
Merge branch 'main' into feature-CMake_CI_3
sandro-elsweijer Aug 13, 2024
9cf701b
Merge branch 'feature-CMake_CI_2' into feature-CMake_CI_3
sandro-elsweijer Aug 13, 2024
8634236
Update api/Makefile.am
chiaraMaHe Aug 19, 2024
574ee3e
Remove # to add fortran_specific_mk
chiaraMaHe Aug 19, 2024
2a514b8
Rename file
chiaraMaHe Aug 19, 2024
e8fda9e
Merge branch 'feature-CMake_CI_2' into feature-CMake_CI_3
sandro-elsweijer Aug 20, 2024
3b187f1
add input description for cmake ci t8code api tests
sandro-elsweijer Aug 20, 2024
a5799d7
switch from ninja test to ctest for parallel test execution
sandro-elsweijer Aug 20, 2024
2b7cb44
execute tests in serial bc its faster
sandro-elsweijer Aug 23, 2024
9cf9ec3
Add t8_fortran.m4 to Makefile
chiaraMaHe Sep 16, 2024
3cfce56
Change name of fortran file
chiaraMaHe Sep 16, 2024
c870226
Add t8_fortran.m4
chiaraMaHe Sep 16, 2024
01d3c33
Merge remote-tracking branch 'origin/fortran-interface' into feature-…
Sep 24, 2024
158de95
Merge remote-tracking branch 'origin/fortran-build' into feature-fort…
Sep 24, 2024
ce35a77
Renamed Fortran interface module.
Sep 24, 2024
d147732
Updated makefile to new fortran interface module name.
Sep 24, 2024
e48d01f
Added _mod suffix.
Sep 24, 2024
13fedd2
CMake build for Fortran interface.
Sep 24, 2024
cc743ca
Fixed autotools.
Sep 24, 2024
1523f92
Reorganized autools Fortran interface.
Sep 24, 2024
361f16a
Added MPI Fortran test.
Sep 24, 2024
725acde
Merge branch 'main' into feature-fortran-interface
Sep 24, 2024
e4df9dd
Added comment and license.
Sep 24, 2024
41c337f
Ignore CMake related cache files.
Sep 24, 2024
9667de5
Refinement.
Sep 24, 2024
aa66820
Added license.
Sep 24, 2024
e8f3def
Code cleanup.
Sep 24, 2024
7293849
Fixed typo.
Sep 25, 2024
8a9305d
Appended parallel suffix to Fortran linkage test.
Sep 26, 2024
5fb4b56
Merge branch 'main' into feature-CMake_CI_3
sandro-elsweijer Sep 26, 2024
7c56ce6
enforce MPI in api tests
sandro-elsweijer Sep 27, 2024
91433fa
update fortran build flag in ci
sandro-elsweijer Sep 27, 2024
0163f0c
Merge branch 'feature-CMake_CI_3' into feature-fortran-interface
Sep 27, 2024
8116ab9
Added warning and reverted parameter in GH action.
Sep 27, 2024
f2e77f3
Merge branch 'main' into feature-fortran-interface
Sep 27, 2024
269252f
Merge branch 'main' into feature-fortran-interface
Sep 27, 2024
1401af5
Enable api workflow
sandro-elsweijer Sep 30, 2024
0304b62
Merge branch 'main' into feature-fortran-interface
Davknapp Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests_cmake_t8code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
run: export LESS_TEST_OPTION="-DT8CODE_ENABLE_LESS_TESTS=ON"
&& echo LESS_TEST_OPTION="$LESS_TEST_OPTION" >> $GITHUB_ENV
- name: build config variables
run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake"
run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_FORTRAN_INTERFACE=$MPI -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake"
jmark marked this conversation as resolved.
Show resolved Hide resolved
&& echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV
# cmake and test
- name: Printing MPI compiler info
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ config.status
Doxyfile
doxygen/

CMakeCache.txt
CMakeFiles/

src/stamp-h1
src/t8_config.h
src/pre_config.h
Expand Down
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(cmake/GitProjectVersion.cmake)

project( T8CODE
DESCRIPTION "Parallel algorithms and data structures for tree-based AMR with arbitrary element shapes."
LANGUAGES C CXX
LANGUAGES C CXX Fortran
VERSION "${T8CODE_VERSION_MAJOR}.${T8CODE_VERSION_MINOR}.${T8CODE_VERSION_PATCH}" )
include( CTest )

Expand All @@ -15,6 +15,7 @@ option( T8CODE_BUILD_TESTS "Build t8code's automated tests" ON )
option( T8CODE_BUILD_TUTORIALS "Build t8code's tutorials" ON )
option( T8CODE_BUILD_EXAMPLES "Build t8code's examples" ON )
option( T8CODE_BUILD_BENCHMARKS "Build t8code's benchmarks" ON )
option( T8CODE_BUILD_FORTRAN_INTERFACE "Build t8code's Fortran interface" OFF )
option( T8CODE_ENABLE_LESS_TESTS "Tests not as thoroughly to speed up the test suite. Tests the same functionality. (WARNING: Use with care.)" OFF )

option( T8CODE_ENABLE_MPI "Enable t8code's features which rely on MPI" ON )
Expand Down Expand Up @@ -56,7 +57,12 @@ set( CMAKE_CXX_EXTENSIONS OFF )
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

if( T8CODE_ENABLE_MPI )
find_package( MPI COMPONENTS C REQUIRED )
if( T8CODE_BUILD_FORTRAN_INTERFACE )
jmark marked this conversation as resolved.
Show resolved Hide resolved
find_package( MPI COMPONENTS C Fortran REQUIRED )
else()
find_package( MPI COMPONENTS C REQUIRED )
endif()

if( NOT MPIEXEC_EXECUTABLE )
message( FATAL_ERROR "MPIEXEC was not found" )
endif()
Expand Down Expand Up @@ -136,3 +142,8 @@ endif()
if ( T8CODE_BUILD_DOCUMENTATION )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/doc )
endif()

if( T8CODE_BUILD_FORTRAN_INTERFACE )
enable_language( Fortran )
add_subdirectory( ${CMAKE_CURRENT_LIST_DIR}/api/t8_fortran_interface )
endif()
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dist_t8aclocal_DATA = config/t8_include.m4 \
config/t8_netcdf.m4 \
config/t8_vtk.m4 \
config/t8_occ.m4 \
config/t8_fortran.m4 \
config/t8_mpi.m4


Expand Down
18 changes: 17 additions & 1 deletion api/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,24 @@ libt8_installed_headers_fortran_interface = \

dist_fortraninterfaceinclude_HEADERS = $(libt8_installed_headers_fortran_interface)

# Save the module sources in a different variable for later use
t8_fortran_module_sources = api/t8_fortran_interface/t8_fortran_interface_mod.f90

# Add the Fortran sources to the lib
libt8_compiled_sources += $(t8_fortran_module_sources)

AM_FCFLAGS =
libt8_compiled_sources += \
api/t8_fortran_interface/t8_fortran_interface.c

AM_CPPFLAGS += -I@top_srcdir@/api
AM_CPPFLAGS += -I@top_srcdir@/api/t8_fortran_interface
MODSOURCES = $(t8_fortran_module_sources)

src_libt8_la_FCFLAGS = $(AM_FCFLAGS)
src_libt8_la_FFLAGS = $(FFLAGS)

# Include the Fortran specific variables and rules
include api/t8_fortran_interface/t8_fortran_specific.mk

# T8_ENABLE_FORTRAN
endif
18 changes: 18 additions & 0 deletions api/t8_fortran_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Link in C-Fortran interface file into libt8.
target_sources( T8 PRIVATE t8_fortran_interface.c )
target_sources( T8 PRIVATE t8_fortran_interface_mod.f90 )

# Add this directory to header search path.
target_include_directories( T8 PRIVATE ${CMAKE_CURRENT_LIST_DIR} )

# Install header files.
install(
FILES ${CMAKE_CURRENT_LIST_DIR}/t8_fortran_interface.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/t8_fortran_interface
)

# Install module files.
install(
FILES ${CMAKE_BINARY_DIR}/src/t8_fortran_interface_mod.mod
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/t8_fortran_interface
)
2 changes: 1 addition & 1 deletion api/t8_fortran_interface/t8_fortran_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#include <api/t8_fortran_interface/t8_fortran_interface.h>
#include <t8_fortran_interface.h>
#include <t8_forest/t8_forest_general.h>
#include <t8_forest/t8_forest_geometrical.h>
#include <t8_cmesh/t8_cmesh_examples.h>
Expand Down
1 change: 1 addition & 0 deletions api/t8_fortran_interface/t8_fortran_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <t8.h>
#include <t8_cmesh.h>
#include <t8_forest/t8_forest_general.h>
#include <t8_forest/t8_forest_geometrical.h>

typedef int (*t8_fortran_adapt_coordinate_callback) (double x, double y, double z, int is_family);

Expand Down
Loading