Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2025 The plumed team 3 : (see the PEOPLE file at the root of the distribution for a list of names) 4 : 5 : See http://www.plumed.org for more information. 6 : 7 : This file is part of plumed, version 2. 8 : 9 : plumed is free software: you can redistribute it and/or modify 10 : it under the terms of the GNU Lesser General Public License as published by 11 : the Free Software Foundation, either version 3 of the License, or 12 : (at your option) any later version. 13 : 14 : plumed is distributed in the hope that it will be useful, 15 : but WITHOUT ANY WARRANTY; without even the implied warranty of 16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 : GNU Lesser General Public License for more details. 18 : 19 : You should have received a copy of the GNU Lesser General Public License 20 : along with plumed. If not, see <http://www.gnu.org/licenses/>. 21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 22 : #ifndef __PLUMED_core_AccelerableShortcut_h 23 : #define __PLUMED_core_AccelerableShortcut_h 24 : 25 : #include "ActionShortcut.h" 26 : 27 : namespace PLMD { 28 : 29 : template <class CV> 30 : struct AccelerableShortcut : public ActionShortcut { 31 : 32 248 : static void registerKeywords(Keywords& keys ) { 33 248 : CV::registerKeywords( keys ); 34 2705 : for (auto& key : keys.getKeys()) { 35 4914 : if( keys.style( key, "atoms" ) ) { 36 150 : keys.reset_style( key, "numbered" ); 37 : } 38 : } 39 248 : keys.addActionNameSuffix("_CPU"); 40 496 : keys.addActionNameSuffix("_ACC"); 41 : //GPU related settings 42 248 : if (!keys.exists("USEGPU")) { 43 0 : keys.addFlag("USEGPU",false,"run this calculation on the GPU or the accelerated version, if available"); 44 0 : keys.addLinkInDocForFlag("USEGPU","plugin_openaccPTM.md"); 45 : } 46 248 : } 47 : 48 136 : AccelerableShortcut(const ActionOptions&ao): 49 : Action(ao), 50 136 : ActionShortcut(ao) { 51 136 : bool usegpuFLAG=false; 52 136 : parseFlag("USEGPU",usegpuFLAG); 53 544 : readInputLine( getShortcutLabel() + ": " 54 : + getName() + (usegpuFLAG ? "_ACC ":"_CPU ") 55 : + convertInputLineToString() ); 56 140 : } 57 : }; 58 : } // namespace PLMD 59 : #endif