Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 31 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ add_library(cm_core STATIC
cpp/cpu/cpu_contacts.cpp
cpp/cpu/cpu_constraints.cpp
cpp/cpu/cpu_coupled.cpp
cpp/cpu/cpu_flow.cpp
cpp/cpu/cpu_mechanics.cpp
cpp/cpu/cpu_species.cpp
)
add_library(cm::core ALIAS cm_core)

target_compile_features(cm_core PUBLIC cxx_std_23)
target_include_directories(cm_core PUBLIC cpp/include)
target_include_directories(cm_core PUBLIC cpp/include PRIVATE cpp)
set_target_properties(cm_core PROPERTIES POSITION_INDEPENDENT_CODE ON)

if(CM_ENABLE_METAL)
Expand All @@ -51,6 +52,7 @@ if(CM_ENABLE_METAL)

set(CM_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(CM_METAL_GROWTH_HEADER "${CM_GENERATED_DIR}/cm/metal/growth_source.hpp")
set(CM_METAL_FLOW_HEADER "${CM_GENERATED_DIR}/cm/metal/flow_source.hpp")
set(CM_METAL_CONTACTS_HEADER "${CM_GENERATED_DIR}/cm/metal/contacts_source.hpp")
set(CM_METAL_COUPLED_RATES_HEADER "${CM_GENERATED_DIR}/cm/metal/coupled_rates_source.hpp")
set(CM_METAL_MECHANICS_HEADER "${CM_GENERATED_DIR}/cm/metal/mechanics_source.hpp")
Expand All @@ -68,6 +70,18 @@ if(CM_ENABLE_METAL)
cmake/EmbedMetalSource.cmake
VERBATIM
)
add_custom_command(
OUTPUT "${CM_METAL_FLOW_HEADER}"
COMMAND "${CMAKE_COMMAND}"
"-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/cpp/metal/kernels/flow.metal"
"-DOUTPUT=${CM_METAL_FLOW_HEADER}"
"-DSYMBOL=flow_source"
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/EmbedMetalSource.cmake"
DEPENDS
cpp/metal/kernels/flow.metal
cmake/EmbedMetalSource.cmake
VERBATIM
)
add_custom_command(
OUTPUT "${CM_METAL_CONTACTS_HEADER}"
COMMAND "${CMAKE_COMMAND}"
Expand Down Expand Up @@ -131,9 +145,11 @@ if(CM_ENABLE_METAL)

target_sources(cm_core PRIVATE
cpp/metal/metal_backend.mm
cpp/metal/metal_flow.mm
"${CM_METAL_CONTACTS_HEADER}"
"${CM_METAL_COUPLED_RATES_HEADER}"
"${CM_METAL_GROWTH_HEADER}"
"${CM_METAL_FLOW_HEADER}"
"${CM_METAL_MECHANICS_HEADER}"
"${CM_METAL_SIGNALS_HEADER}"
"${CM_METAL_SPECIES_HEADER}"
Expand All @@ -158,9 +174,11 @@ if(CM_ENABLE_CUDA)

target_sources(cm_core PRIVATE
cpp/cuda/cuda_backend.cu
cpp/cuda/cuda_flow.cu
cpp/cuda/kernels/contacts.cu
cpp/cuda/kernels/coupled_rates.cu
cpp/cuda/kernels/growth.cu
cpp/cuda/kernels/flow.cu
cpp/cuda/kernels/mechanics.cu
cpp/cuda/kernels/signals.cu
cpp/cuda/kernels/species.cu
Expand Down Expand Up @@ -225,6 +243,10 @@ if(CM_BUILD_TESTS)
target_link_libraries(cm_coupled_rates_test PRIVATE cm::core)
add_test(NAME coupled_rates COMMAND cm_coupled_rates_test)

add_executable(cm_flow_test tests/cpp/flow_test.cpp)
target_link_libraries(cm_flow_test PRIVATE cm::core)
add_test(NAME flow COMMAND cm_flow_test)

add_executable(cm_checkpoint_test tests/cpp/checkpoint_test.cpp)
target_link_libraries(cm_checkpoint_test PRIVATE cm::core)
target_include_directories(cm_checkpoint_test PRIVATE tests/conformance)
Expand Down Expand Up @@ -264,6 +286,14 @@ if(CM_BUILD_TESTS)
add_test(NAME coupled_rates_conformance COMMAND cm_coupled_rates_conformance_test)
set_tests_properties(coupled_rates_conformance PROPERTIES LABELS conformance)

add_executable(cm_flow_conformance_test
tests/conformance/flow_conformance_test.cpp
)
target_link_libraries(cm_flow_conformance_test PRIVATE cm::core)
target_include_directories(cm_flow_conformance_test PRIVATE tests/conformance)
add_test(NAME flow_conformance COMMAND cm_flow_conformance_test)
set_tests_properties(flow_conformance PROPERTIES LABELS conformance)

add_executable(cm_lifecycle_conformance_test
tests/conformance/lifecycle_conformance_test.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CellModeller2 is an accelerator-native successor to [CellModeller](https://github.com/cellmodeller/CellModeller) for individual-based multicellular modeling. It combines a Python modeling interface with a C++23 engine and independent CPU, Apple Metal, and NVIDIA CUDA implementations.

Models can combine rod-shaped growth and division, lineage, contact mechanics and constraints, intracellular dynamics, and cell-grid signaling. Versioned checkpoints, batch manifests, data-only scenes, and Parquet/Zarr exports support reproducible research workflows.
Models can combine rod-shaped growth and division, lineage, contact mechanics and constraints, intracellular dynamics, cell-grid signaling, and steady fluid flow through voxelized microfluidic device geometries. Both depth-averaged Darcy-Brinkman flow and resolved staggered-grid Stokes-Brinkman flow execute through the selected CPU, Metal, or CUDA backend. Versioned checkpoints, batch manifests, data-only scenes, and Parquet/Zarr exports support reproducible research workflows.

## Backend status

Expand Down
Loading