Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #include "KokkosLocalParallelInterface.h" 11 : 12 : namespace Moose::Kokkos 13 : { 14 : 15 : InputParameters 16 70276 : LocalParallelInterface::validParams() 17 : { 18 70276 : auto params = emptyInputParameters(); 19 : 20 : // The default values are chosen empirically for first-order Lagrange shape functions in 3D 21 : // geometries. Higher-order shape functions can benefit from using more local threads, but the 22 : // default values will still provide moderate performance improvement. Residual calculation 23 : // shows negative impacts after certain thread count, so its default value is smaller than that of 24 : // Jacobian calculation. 25 214164 : params.addParam<unsigned int>("num_local_residual_threads", 26 133880 : 2, 27 : "The number of threads for additional parallelization of local " 28 : "DOFs in residual calculation."); 29 143888 : params.addParam<unsigned int>("num_local_jacobian_threads", 30 133880 : 4, 31 : "The number of threads for additional parallelization of local " 32 : "DOFs in Jacobian calculation."); 33 : 34 70276 : return params; 35 0 : } 36 : 37 8640 : LocalParallelInterface::LocalParallelInterface(const MooseObject * moose_object) 38 : #ifdef MOOSE_ENABLE_KOKKOS_GPU 39 : : _num_local_residual_threads(moose_object->getParam<unsigned int>("num_local_residual_threads")), 40 : _num_local_jacobian_threads(moose_object->getParam<unsigned int>("num_local_jacobian_threads")) 41 : #else 42 2040 : : _num_local_residual_threads(1), _num_local_jacobian_threads(1) 43 : #endif 44 : { 45 : #ifndef MOOSE_ENABLE_KOKKOS_GPU 46 6120 : if (moose_object->isParamSetByUser("num_local_residual_threads")) 47 0 : moose_object->paramError("num_local_residual_threads", 48 : "Should not be set when using Kokkos CPU backend."); 49 6120 : if (moose_object->isParamSetByUser("num_local_jacobian_threads")) 50 0 : moose_object->paramError("num_local_jacobian_threads", 51 : "Should not be set when using Kokkos CPU backend."); 52 : #endif 53 3690 : } 54 : 55 : } // namespace Moose::Kokkos