As per discussion with @IvanGrigorik on March 9, 2026 and Slack messages with @JBludau, this issue is a request for added functionality to be able to run a function defined in Python inside a C++ parallel_ loop. The goal is for users to easily change functionality in the C++ loop without having to change the C++ code base and recompile. Say there is a simple C++ function like:
KOKKOS_FUNCTION void compute(const Matrix<double,6,1> &strain,Matrix<double,6,1> &stress) const {
stress += strain * 100;
}
That is used inside a parallel_ loop such as:
Kokkos::parallel_for("updateStrainStress",Kokkos::RangePolicy<ExecSpace>(0, num_),KOKKOS_CLASS_LAMBDA(uint64_t mp) {
DMat vGrad = velGrad_.view_device()(mp);
SymTen strainInc(0);
compXX(strainInc) = vGrad(0,0) * timestep;
compXY(strainInc) = (vGrad(0,1) + vGrad(1,0)) * hTimeStep;
compYY(strainInc) = vGrad(1,1) * timestep;
compute(strainInc,stress_.view_device()(mp));
});
The goal is to be able to write a Python function instead for the compute method and then be able to call it inside the updateStrainStress parallel_for loop in C++.
As per discussion with @IvanGrigorik on March 9, 2026 and Slack messages with @JBludau, this issue is a request for added functionality to be able to run a function defined in Python inside a C++ parallel_ loop. The goal is for users to easily change functionality in the C++ loop without having to change the C++ code base and recompile. Say there is a simple C++ function like:
That is used inside a parallel_ loop such as:
The goal is to be able to write a Python function instead for the compute method and then be able to call it inside the updateStrainStress parallel_for loop in C++.