Skip to content

Commit

Permalink
Merge pull request #34 from EuropeanSpallationSource/orbit-mpi
Browse files Browse the repository at this point in the history
Automated enabling of MPI support
  • Loading branch information
azukov authored Dec 12, 2024
2 parents 54a6ab2 + 03f448f commit ac20928
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 206 deletions.
1 change: 1 addition & 0 deletions py/orbit/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import orbit_mpi
10 changes: 10 additions & 0 deletions py/orbit/core/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

py_sources = files([
'__init__.py',
])

python.install_sources(
py_sources,
subdir: 'orbit/core',
# pure: true,
)
1 change: 1 addition & 0 deletions py/orbit/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

subdir('bumps')
subdir('core')
subdir('matching')
subdir('time_dep')
subdir('bunch_utils')
Expand Down
111 changes: 0 additions & 111 deletions src/libmain/libmain.cc

This file was deleted.

15 changes: 0 additions & 15 deletions src/libmain/module_template/__init__.py

This file was deleted.

13 changes: 0 additions & 13 deletions src/libmain/orbit/__init__.py

This file was deleted.

18 changes: 0 additions & 18 deletions src/libmain/orbit/_module_loader.py

This file was deleted.

32 changes: 0 additions & 32 deletions src/libmain/orbit/pyORBIT.py

This file was deleted.

34 changes: 18 additions & 16 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ dependencies = []

dependencies += dependency('fftw3', version: '>= 3.0.0', required: true)

# Detecting if MPICH or OPENMPI are installed and enabling support if present
mpich_dependency = dependency('mpich', version: '>= 4.0.0', required: false)
openmpi_dependency = dependency('ompi', version: '>= 5.0.0', required: false)

if mpich_dependency.found()
cpp_args = ['-fPIC', '-std=c++11', '-DUSE_MPI=1']
dependencies += mpich_dependency
elif openmpi_dependency.found()
cpp_args = ['-fPIC', '-std=c++11', '-DUSE_MPI=1']
dependencies += openmpi_dependency
else
cpp_args = ['-fPIC', '-std=c++11']
endif

sources = files([
'linac/wrap_linacmodule.cc',
'linac/tracking/linac_tracking.cc',
Expand Down Expand Up @@ -111,7 +125,6 @@ sources = files([
'trackerrk4/PyExternalEffects.cc',
'trackerrk4/RungeKuttaTracker.cc',
'trackerrk4/wrap_ext_effects_container.cc',
'libmain/libmain.cc',
'mpi/wrap_orbit_mpi.cc',
'mpi/wrap_mpi_comm.cc',
'mpi/orbit_mpi.cc',
Expand Down Expand Up @@ -208,7 +221,7 @@ sources = files([
'teapot/wrap_matrix_generator.cc',
'teapot/teapotbase.cc',
'teapot/MatrixGenerator.cc'
])
])
inc = include_directories([
python.get_variable('INCLUDEPY', ''),
'main',
Expand Down Expand Up @@ -237,31 +250,26 @@ inc = include_directories([
'orbit/BunchDiagnostics',
'orbit',
'utils/integration',
'libmain',
'orbit/Apertures'

])


core_lib = library('core',
sources: sources,
include_directories: inc,
cpp_args: ['-fPIC', '-std=c++11'],
cpp_args: cpp_args,
override_options: ['b_lundef=false'],
dependencies: dependencies,
install: true,

)

core_dep = declare_dependency(link_with : core_lib)




python.extension_module('orbit_mpi',
sources: [base + '/mpi_init.cc'],
include_directories: inc,
cpp_args: ['-fPIC', '-std=c++11'],
cpp_args: cpp_args,
dependencies: [core_dep],
install: true,
subdir: 'orbit/core',
Expand Down Expand Up @@ -393,9 +401,3 @@ python.extension_module('error_base',
install: true,
subdir: 'orbit/core',
)






2 changes: 1 addition & 1 deletion src/mpi/wrap_orbit_mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace wrap_orbit_mpi{
};

PyMODINIT_FUNC initorbit_mpi(void) {
// Initialize MPI
// Initialize MPI
ORBIT_MPI_Init();

PyObject *m, *d;
Expand Down

0 comments on commit ac20928

Please sign in to comment.