Commit 3948e71
Type erasure (#771)
* Implement type-erased MICM solvers with runtime CUDA loading
This refactors the MICM wrapper to use type erasure for solver and state
classes, enabling a uniform ABI regardless of CUDA availability. CUDA
solvers are now loaded at runtime via dlopen/dlsym on Linux.
Key changes:
- Add IMicmSolver and IState interfaces for type erasure
- Create CpuSolver/CpuState implementations using internal std::variant
- Add CudaLoader singleton for runtime CUDA plugin loading
- Create separate libmusica_cuda.so plugin with factory functions
- Remove #ifdef MUSICA_ENABLE_CUDA from public headers
- Simplify Python bindings to single _musica module
- Update tests to use runtime CUDA detection with GTEST_SKIP
Benefits:
- Single libmusica.so works with or without CUDA
- No ABI differences between CUDA and non-CUDA builds
- Single Python wheel can optionally use CUDA at runtime
- Reduced recompilation needed for different build variants
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Refactor CMake to use target_sources and link Python against musica
- Replace source variable collection with direct target_sources() calls
- Python module now links against musica library instead of compiling
all sources directly
- Remove unused MODE parameter from musica_setup_target function
- Remove MUSICA_ONLY_PYTHON option (musica library always built)
This simplifies the build and ensures Python bindings use the same
compiled library as C/C++ users.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Inline musica_setup_target into src/CMakeLists.txt
Move the musica target configuration directly into src/CMakeLists.txt
and remove the now-unused setup_musica_target.cmake file. This
simplifies the build system by keeping all musica library configuration
in one place.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Remove musica_cuda_abi_version function
The ABI version checking is not necessary for the CUDA plugin.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* removing unused options, simplifying cmake
* Add prebuilt musica support for faster Python wheel builds
On Linux, the musica library is now prebuilt once during cibuildwheel's
before-all hook, then reused for all Python version builds. This avoids
rebuilding the C++/Fortran code 5 times (once per Python version).
Changes:
- Add MUSICA_USE_PREBUILT CMake option to use find_package(musica)
- Update dependencies.cmake to skip fetching deps when using prebuilt
- Update prepare_build_environment_linux.sh to prebuild musica
- Update pyproject.toml with Linux override for prebuilt
- Update repair_wheel_gpu.sh for new CUDA plugin architecture
- Update python/bindings/CMakeLists.txt for prebuilt CUDA plugin
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add prebuilt musica support for Windows and macOS wheel builds
Extends the prebuilt library optimization (previously Linux-only) to
Windows and macOS. The C++/Fortran code is now compiled once per
platform in the before-all hook, then reused for all Python versions.
- Update prepare_build_environment_macos.sh to prebuild musica
- Add prepare_build_environment_windows.sh for MSYS2 environment
- Configure scikit-build to use prebuilt libraries on all platforms
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix prebuilt musica dependencies for CARMA
When using a prebuilt musica library with CARMA enabled, the exported
targets reference BLAS::BLAS and LAPACK::LAPACK. The musicaConfig.cmake
must find these dependencies before loading the exported targets.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Hide yaml-cpp from public API using opaque pointer
Refactor Configuration struct to use void* instead of YAML::Node* to
hide yaml-cpp as an implementation detail. This removes yaml-cpp from
the public header, eliminating the need to expose it as a dependency
when using prebuilt musica libraries.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* using different mech config hash
* applyig MUSICA_USE_PREBUILT only for cibuildwheel
* temporarily disable cli tests
* correcting javascript bindings, enabling carma?
* not building carma on windows arm
* adding build shared libs option
* bundling sources
* correcting wheel repair
* Fix macOS wheel delocate by bundling dylib files
The install_prebuilt_so function only handled .so files (Linux), missing
macOS .dylib files. Added platform-specific handling and a custom repair
script that ensures dylibs are bundled before delocate runs.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix Windows duplicate symbol error by building yaml-cpp as shared lib
When MUSICA_BUILD_SHARED_LIBS=ON, yaml-cpp is now also built as shared
to prevent duplicate symbols. mechanism_configuration links yaml-cpp as
PUBLIC, so when it was a DLL with yaml-cpp statically linked, musica
would see duplicate symbols from both libyaml-cpp.a and the DLL.
Also added Windows DLL support to install_prebuilt_libs and updated
the Windows repair script to include prebuilt and clangarm64 paths.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* trying to fix yaml links
* attempting to fix wheel and cmake build errors
* installing libraries when not prebuilt
* logging
* removing python build from linux runner
* removing python builds from other tests
* micm conditions correction
* Fix Windows wheel repair by installing DLLs to bin/
Add RUNTIME DESTINATION to CMake install rules so that .dll files
are installed alongside import libraries on Windows. Without this,
only .dll.a files were installed to lib/ and delvewheel could not
find the actual DLLs needed for wheel repair.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* correcing nvidia dockerfile
* Fix CudaLoader thread safety with std::call_once (#777)
* Initial plan
* Implement thread-safe CudaLoader using std::call_once
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>
* Make LoadLibrary() const to eliminate const_cast
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>
* bumping mech config tag
* adding const
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>
Co-authored-by: Kyle Shores <kyle.shores44@gmail.com>
* Fix ODR violation in CUDA plugin by separating header from implementation (#779)
* Initial plan
* Fix ODR violation by separating CUDA solver header from implementation
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>
* pr comments, updating micm api
* micm commit
* correcting map type
* removing log
* bumping micm tag, not saving animation in CI
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: K20shores <13836216+K20shores@users.noreply.github.com>1 parent 3d8f7a6 commit 3948e71
56 files changed
Lines changed: 2046 additions & 703 deletions
File tree
- .github/workflows
- cmake
- docker
- fortran
- micm
- test/integration
- include/musica
- micm
- javascript
- bindings
- python
- bindings
- micm
- musica
- examples
- micm
- test/unit/micm
- tools
- src
- carma
- cuda
- micm
- packaging
- test/unit/micm
- tuvx
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 41 | | |
45 | 42 | | |
46 | | - | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 46 | + | |
53 | 47 | | |
54 | 48 | | |
55 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 24 | | |
28 | 25 | | |
29 | 26 | | |
| |||
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | | - | |
41 | 37 | | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 42 | | |
51 | 43 | | |
52 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 26 | | |
34 | | - | |
| 27 | + | |
35 | 28 | | |
36 | 29 | | |
37 | 30 | | |
| |||
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
56 | | - | |
| 49 | + | |
57 | 50 | | |
58 | 51 | | |
59 | 52 | | |
| |||
71 | 64 | | |
72 | 65 | | |
73 | 66 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 67 | | |
82 | | - | |
| 68 | + | |
83 | 69 | | |
84 | 70 | | |
85 | 71 | | |
| |||
96 | 82 | | |
97 | 83 | | |
98 | 84 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 85 | | |
104 | 86 | | |
105 | 87 | | |
| |||
122 | 104 | | |
123 | 105 | | |
124 | 106 | | |
125 | | - | |
126 | 107 | | |
127 | 108 | | |
128 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
119 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
120 | 124 | | |
121 | 125 | | |
122 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | | - | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
| |||
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
| 72 | + | |
75 | 73 | | |
76 | | - | |
| 74 | + | |
77 | 75 | | |
78 | | - | |
| 76 | + | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
| 88 | + | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
| |||
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
| 98 | + | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
0 commit comments