hillclimber 0.1.6__cp313-cp313-macosx_15_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (468) hide show
  1. hillclimber/__init__.py +41 -0
  2. hillclimber/actions.py +53 -0
  3. hillclimber/analysis.py +590 -0
  4. hillclimber/biases.py +293 -0
  5. hillclimber/calc.py +22 -0
  6. hillclimber/cvs.py +1070 -0
  7. hillclimber/interfaces.py +133 -0
  8. hillclimber/metadynamics.py +416 -0
  9. hillclimber/nodes.py +6 -0
  10. hillclimber/opes.py +359 -0
  11. hillclimber/pycv.py +362 -0
  12. hillclimber/selectors.py +230 -0
  13. hillclimber/virtual_atoms.py +341 -0
  14. hillclimber-0.1.6.dist-info/METADATA +325 -0
  15. hillclimber-0.1.6.dist-info/RECORD +468 -0
  16. hillclimber-0.1.6.dist-info/WHEEL +6 -0
  17. hillclimber-0.1.6.dist-info/entry_points.txt +8 -0
  18. hillclimber-0.1.6.dist-info/licenses/LICENSE +165 -0
  19. plumed/__init__.py +104 -0
  20. plumed/_lib/bin/plumed +0 -0
  21. plumed/_lib/bin/plumed-config +9 -0
  22. plumed/_lib/bin/plumed-patch +9 -0
  23. plumed/_lib/include/plumed/adjmat/AdjacencyMatrixBase.h +659 -0
  24. plumed/_lib/include/plumed/adjmat/ContactMatrix.h +59 -0
  25. plumed/_lib/include/plumed/asmjit/arch.h +228 -0
  26. plumed/_lib/include/plumed/asmjit/arm.h +43 -0
  27. plumed/_lib/include/plumed/asmjit/asmjit.h +69 -0
  28. plumed/_lib/include/plumed/asmjit/asmjit_apibegin.h +143 -0
  29. plumed/_lib/include/plumed/asmjit/asmjit_apiend.h +93 -0
  30. plumed/_lib/include/plumed/asmjit/asmjit_build.h +971 -0
  31. plumed/_lib/include/plumed/asmjit/assembler.h +183 -0
  32. plumed/_lib/include/plumed/asmjit/base.h +56 -0
  33. plumed/_lib/include/plumed/asmjit/codebuilder.h +944 -0
  34. plumed/_lib/include/plumed/asmjit/codecompiler.h +767 -0
  35. plumed/_lib/include/plumed/asmjit/codeemitter.h +528 -0
  36. plumed/_lib/include/plumed/asmjit/codeholder.h +777 -0
  37. plumed/_lib/include/plumed/asmjit/constpool.h +286 -0
  38. plumed/_lib/include/plumed/asmjit/cpuinfo.h +402 -0
  39. plumed/_lib/include/plumed/asmjit/func.h +1327 -0
  40. plumed/_lib/include/plumed/asmjit/globals.h +370 -0
  41. plumed/_lib/include/plumed/asmjit/inst.h +137 -0
  42. plumed/_lib/include/plumed/asmjit/logging.h +317 -0
  43. plumed/_lib/include/plumed/asmjit/misc_p.h +103 -0
  44. plumed/_lib/include/plumed/asmjit/moved_string.h +318 -0
  45. plumed/_lib/include/plumed/asmjit/operand.h +1599 -0
  46. plumed/_lib/include/plumed/asmjit/osutils.h +207 -0
  47. plumed/_lib/include/plumed/asmjit/regalloc_p.h +597 -0
  48. plumed/_lib/include/plumed/asmjit/runtime.h +227 -0
  49. plumed/_lib/include/plumed/asmjit/simdtypes.h +1104 -0
  50. plumed/_lib/include/plumed/asmjit/utils.h +1387 -0
  51. plumed/_lib/include/plumed/asmjit/vmem.h +183 -0
  52. plumed/_lib/include/plumed/asmjit/x86.h +45 -0
  53. plumed/_lib/include/plumed/asmjit/x86assembler.h +125 -0
  54. plumed/_lib/include/plumed/asmjit/x86builder.h +117 -0
  55. plumed/_lib/include/plumed/asmjit/x86compiler.h +322 -0
  56. plumed/_lib/include/plumed/asmjit/x86emitter.h +5149 -0
  57. plumed/_lib/include/plumed/asmjit/x86globals.h +535 -0
  58. plumed/_lib/include/plumed/asmjit/x86inst.h +2547 -0
  59. plumed/_lib/include/plumed/asmjit/x86instimpl_p.h +74 -0
  60. plumed/_lib/include/plumed/asmjit/x86internal_p.h +108 -0
  61. plumed/_lib/include/plumed/asmjit/x86logging_p.h +92 -0
  62. plumed/_lib/include/plumed/asmjit/x86misc.h +417 -0
  63. plumed/_lib/include/plumed/asmjit/x86operand.h +1133 -0
  64. plumed/_lib/include/plumed/asmjit/x86regalloc_p.h +734 -0
  65. plumed/_lib/include/plumed/asmjit/zone.h +1157 -0
  66. plumed/_lib/include/plumed/bias/Bias.h +82 -0
  67. plumed/_lib/include/plumed/bias/ReweightBase.h +58 -0
  68. plumed/_lib/include/plumed/blas/blas.h +253 -0
  69. plumed/_lib/include/plumed/blas/def_external.h +61 -0
  70. plumed/_lib/include/plumed/blas/def_internal.h +97 -0
  71. plumed/_lib/include/plumed/blas/real.h +49 -0
  72. plumed/_lib/include/plumed/cltools/CLTool.h +32 -0
  73. plumed/_lib/include/plumed/clusters/ClusteringBase.h +70 -0
  74. plumed/_lib/include/plumed/colvar/Colvar.h +32 -0
  75. plumed/_lib/include/plumed/colvar/ColvarInput.h +68 -0
  76. plumed/_lib/include/plumed/colvar/ColvarShortcut.h +81 -0
  77. plumed/_lib/include/plumed/colvar/CoordinationBase.h +52 -0
  78. plumed/_lib/include/plumed/colvar/MultiColvarTemplate.h +333 -0
  79. plumed/_lib/include/plumed/colvar/PathMSDBase.h +101 -0
  80. plumed/_lib/include/plumed/colvar/RMSDVector.h +78 -0
  81. plumed/_lib/include/plumed/config/Config.h +118 -0
  82. plumed/_lib/include/plumed/config/version.h +9 -0
  83. plumed/_lib/include/plumed/contour/ContourFindingObject.h +87 -0
  84. plumed/_lib/include/plumed/contour/DistanceFromContourBase.h +82 -0
  85. plumed/_lib/include/plumed/contour/FindContour.h +67 -0
  86. plumed/_lib/include/plumed/core/Action.h +540 -0
  87. plumed/_lib/include/plumed/core/ActionAnyorder.h +48 -0
  88. plumed/_lib/include/plumed/core/ActionAtomistic.h +343 -0
  89. plumed/_lib/include/plumed/core/ActionForInterface.h +99 -0
  90. plumed/_lib/include/plumed/core/ActionPilot.h +57 -0
  91. plumed/_lib/include/plumed/core/ActionRegister.h +124 -0
  92. plumed/_lib/include/plumed/core/ActionSet.h +163 -0
  93. plumed/_lib/include/plumed/core/ActionSetup.h +48 -0
  94. plumed/_lib/include/plumed/core/ActionShortcut.h +73 -0
  95. plumed/_lib/include/plumed/core/ActionToGetData.h +59 -0
  96. plumed/_lib/include/plumed/core/ActionToPutData.h +101 -0
  97. plumed/_lib/include/plumed/core/ActionWithArguments.h +140 -0
  98. plumed/_lib/include/plumed/core/ActionWithMatrix.h +87 -0
  99. plumed/_lib/include/plumed/core/ActionWithValue.h +258 -0
  100. plumed/_lib/include/plumed/core/ActionWithVector.h +94 -0
  101. plumed/_lib/include/plumed/core/ActionWithVirtualAtom.h +123 -0
  102. plumed/_lib/include/plumed/core/CLTool.h +177 -0
  103. plumed/_lib/include/plumed/core/CLToolMain.h +102 -0
  104. plumed/_lib/include/plumed/core/CLToolRegister.h +108 -0
  105. plumed/_lib/include/plumed/core/Colvar.h +115 -0
  106. plumed/_lib/include/plumed/core/DataPassingObject.h +94 -0
  107. plumed/_lib/include/plumed/core/DataPassingTools.h +54 -0
  108. plumed/_lib/include/plumed/core/DomainDecomposition.h +120 -0
  109. plumed/_lib/include/plumed/core/ExchangePatterns.h +47 -0
  110. plumed/_lib/include/plumed/core/FlexibleBin.h +63 -0
  111. plumed/_lib/include/plumed/core/GREX.h +61 -0
  112. plumed/_lib/include/plumed/core/GenericMolInfo.h +89 -0
  113. plumed/_lib/include/plumed/core/Group.h +41 -0
  114. plumed/_lib/include/plumed/core/ModuleMap.h +30 -0
  115. plumed/_lib/include/plumed/core/ParallelTaskManager.h +1023 -0
  116. plumed/_lib/include/plumed/core/PbcAction.h +61 -0
  117. plumed/_lib/include/plumed/core/PlumedMain.h +632 -0
  118. plumed/_lib/include/plumed/core/PlumedMainInitializer.h +118 -0
  119. plumed/_lib/include/plumed/core/RegisterBase.h +340 -0
  120. plumed/_lib/include/plumed/core/TargetDist.h +48 -0
  121. plumed/_lib/include/plumed/core/Value.h +547 -0
  122. plumed/_lib/include/plumed/core/WithCmd.h +93 -0
  123. plumed/_lib/include/plumed/dimred/SMACOF.h +55 -0
  124. plumed/_lib/include/plumed/drr/DRR.h +383 -0
  125. plumed/_lib/include/plumed/drr/colvar_UIestimator.h +777 -0
  126. plumed/_lib/include/plumed/fisst/legendre_rule_fast.h +44 -0
  127. plumed/_lib/include/plumed/function/Custom.h +54 -0
  128. plumed/_lib/include/plumed/function/Function.h +85 -0
  129. plumed/_lib/include/plumed/function/FunctionOfMatrix.h +368 -0
  130. plumed/_lib/include/plumed/function/FunctionOfScalar.h +135 -0
  131. plumed/_lib/include/plumed/function/FunctionOfVector.h +296 -0
  132. plumed/_lib/include/plumed/function/FunctionSetup.h +180 -0
  133. plumed/_lib/include/plumed/function/FunctionShortcut.h +130 -0
  134. plumed/_lib/include/plumed/function/FunctionWithSingleArgument.h +165 -0
  135. plumed/_lib/include/plumed/gridtools/ActionWithGrid.h +43 -0
  136. plumed/_lib/include/plumed/gridtools/EvaluateGridFunction.h +99 -0
  137. plumed/_lib/include/plumed/gridtools/FunctionOfGrid.h +295 -0
  138. plumed/_lib/include/plumed/gridtools/GridCoordinatesObject.h +179 -0
  139. plumed/_lib/include/plumed/gridtools/GridSearch.h +135 -0
  140. plumed/_lib/include/plumed/gridtools/Interpolator.h +45 -0
  141. plumed/_lib/include/plumed/gridtools/KDE.h +455 -0
  142. plumed/_lib/include/plumed/gridtools/RDF.h +40 -0
  143. plumed/_lib/include/plumed/gridtools/SumOfKernels.h +219 -0
  144. plumed/_lib/include/plumed/isdb/MetainferenceBase.h +398 -0
  145. plumed/_lib/include/plumed/lapack/def_external.h +207 -0
  146. plumed/_lib/include/plumed/lapack/def_internal.h +388 -0
  147. plumed/_lib/include/plumed/lapack/lapack.h +899 -0
  148. plumed/_lib/include/plumed/lapack/lapack_limits.h +79 -0
  149. plumed/_lib/include/plumed/lapack/real.h +50 -0
  150. plumed/_lib/include/plumed/lepton/CompiledExpression.h +164 -0
  151. plumed/_lib/include/plumed/lepton/CustomFunction.h +143 -0
  152. plumed/_lib/include/plumed/lepton/Exception.h +93 -0
  153. plumed/_lib/include/plumed/lepton/ExpressionProgram.h +137 -0
  154. plumed/_lib/include/plumed/lepton/ExpressionTreeNode.h +145 -0
  155. plumed/_lib/include/plumed/lepton/Lepton.h +85 -0
  156. plumed/_lib/include/plumed/lepton/MSVC_erfc.h +123 -0
  157. plumed/_lib/include/plumed/lepton/Operation.h +1302 -0
  158. plumed/_lib/include/plumed/lepton/ParsedExpression.h +165 -0
  159. plumed/_lib/include/plumed/lepton/Parser.h +111 -0
  160. plumed/_lib/include/plumed/lepton/windowsIncludes.h +73 -0
  161. plumed/_lib/include/plumed/mapping/Path.h +44 -0
  162. plumed/_lib/include/plumed/mapping/PathProjectionCalculator.h +57 -0
  163. plumed/_lib/include/plumed/matrixtools/MatrixOperationBase.h +54 -0
  164. plumed/_lib/include/plumed/matrixtools/MatrixTimesMatrix.h +309 -0
  165. plumed/_lib/include/plumed/matrixtools/MatrixTimesVectorBase.h +365 -0
  166. plumed/_lib/include/plumed/matrixtools/OuterProduct.h +238 -0
  167. plumed/_lib/include/plumed/maze/Core.h +65 -0
  168. plumed/_lib/include/plumed/maze/Loss.h +86 -0
  169. plumed/_lib/include/plumed/maze/Member.h +66 -0
  170. plumed/_lib/include/plumed/maze/Memetic.h +799 -0
  171. plumed/_lib/include/plumed/maze/Optimizer.h +357 -0
  172. plumed/_lib/include/plumed/maze/Random_MT.h +156 -0
  173. plumed/_lib/include/plumed/maze/Tools.h +183 -0
  174. plumed/_lib/include/plumed/metatomic/vesin.h +188 -0
  175. plumed/_lib/include/plumed/molfile/Gromacs.h +2013 -0
  176. plumed/_lib/include/plumed/molfile/endianswap.h +217 -0
  177. plumed/_lib/include/plumed/molfile/fastio.h +683 -0
  178. plumed/_lib/include/plumed/molfile/largefiles.h +78 -0
  179. plumed/_lib/include/plumed/molfile/libmolfile_plugin.h +77 -0
  180. plumed/_lib/include/plumed/molfile/molfile_plugin.h +1034 -0
  181. plumed/_lib/include/plumed/molfile/periodic_table.h +248 -0
  182. plumed/_lib/include/plumed/molfile/readpdb.h +447 -0
  183. plumed/_lib/include/plumed/molfile/vmdplugin.h +236 -0
  184. plumed/_lib/include/plumed/multicolvar/MultiColvarShortcuts.h +45 -0
  185. plumed/_lib/include/plumed/opes/ExpansionCVs.h +79 -0
  186. plumed/_lib/include/plumed/sasa/Sasa.h +32 -0
  187. plumed/_lib/include/plumed/secondarystructure/SecondaryStructureBase.h +372 -0
  188. plumed/_lib/include/plumed/setup/ActionSetup.h +25 -0
  189. plumed/_lib/include/plumed/small_vector/small_vector.h +6114 -0
  190. plumed/_lib/include/plumed/symfunc/CoordinationNumbers.h +41 -0
  191. plumed/_lib/include/plumed/tools/Angle.h +52 -0
  192. plumed/_lib/include/plumed/tools/AtomDistribution.h +138 -0
  193. plumed/_lib/include/plumed/tools/AtomNumber.h +152 -0
  194. plumed/_lib/include/plumed/tools/BiasRepresentation.h +106 -0
  195. plumed/_lib/include/plumed/tools/BitmaskEnum.h +167 -0
  196. plumed/_lib/include/plumed/tools/Brent1DRootSearch.h +159 -0
  197. plumed/_lib/include/plumed/tools/CheckInRange.h +44 -0
  198. plumed/_lib/include/plumed/tools/Citations.h +74 -0
  199. plumed/_lib/include/plumed/tools/ColvarOutput.h +118 -0
  200. plumed/_lib/include/plumed/tools/Communicator.h +316 -0
  201. plumed/_lib/include/plumed/tools/ConjugateGradient.h +80 -0
  202. plumed/_lib/include/plumed/tools/DLLoader.h +79 -0
  203. plumed/_lib/include/plumed/tools/ERMSD.h +73 -0
  204. plumed/_lib/include/plumed/tools/Exception.h +406 -0
  205. plumed/_lib/include/plumed/tools/File.h +28 -0
  206. plumed/_lib/include/plumed/tools/FileBase.h +153 -0
  207. plumed/_lib/include/plumed/tools/FileTools.h +37 -0
  208. plumed/_lib/include/plumed/tools/ForwardDecl.h +54 -0
  209. plumed/_lib/include/plumed/tools/Grid.h +638 -0
  210. plumed/_lib/include/plumed/tools/HistogramBead.h +136 -0
  211. plumed/_lib/include/plumed/tools/IFile.h +117 -0
  212. plumed/_lib/include/plumed/tools/KernelFunctions.h +113 -0
  213. plumed/_lib/include/plumed/tools/Keywords.h +380 -0
  214. plumed/_lib/include/plumed/tools/LatticeReduction.h +66 -0
  215. plumed/_lib/include/plumed/tools/LeptonCall.h +64 -0
  216. plumed/_lib/include/plumed/tools/LinkCells.h +126 -0
  217. plumed/_lib/include/plumed/tools/Log.h +41 -0
  218. plumed/_lib/include/plumed/tools/LoopUnroller.h +163 -0
  219. plumed/_lib/include/plumed/tools/Matrix.h +721 -0
  220. plumed/_lib/include/plumed/tools/MatrixSquareBracketsAccess.h +138 -0
  221. plumed/_lib/include/plumed/tools/MergeVectorTools.h +153 -0
  222. plumed/_lib/include/plumed/tools/Minimise1DBrent.h +244 -0
  223. plumed/_lib/include/plumed/tools/MinimiseBase.h +120 -0
  224. plumed/_lib/include/plumed/tools/MolDataClass.h +51 -0
  225. plumed/_lib/include/plumed/tools/NeighborList.h +112 -0
  226. plumed/_lib/include/plumed/tools/OFile.h +286 -0
  227. plumed/_lib/include/plumed/tools/OpenACC.h +180 -0
  228. plumed/_lib/include/plumed/tools/OpenMP.h +75 -0
  229. plumed/_lib/include/plumed/tools/PDB.h +154 -0
  230. plumed/_lib/include/plumed/tools/Pbc.h +139 -0
  231. plumed/_lib/include/plumed/tools/PlumedHandle.h +105 -0
  232. plumed/_lib/include/plumed/tools/RMSD.h +493 -0
  233. plumed/_lib/include/plumed/tools/Random.h +80 -0
  234. plumed/_lib/include/plumed/tools/RootFindingBase.h +79 -0
  235. plumed/_lib/include/plumed/tools/Stopwatch.h +475 -0
  236. plumed/_lib/include/plumed/tools/Subprocess.h +142 -0
  237. plumed/_lib/include/plumed/tools/SwitchingFunction.h +208 -0
  238. plumed/_lib/include/plumed/tools/Tensor.h +724 -0
  239. plumed/_lib/include/plumed/tools/TokenizedLine.h +123 -0
  240. plumed/_lib/include/plumed/tools/Tools.h +638 -0
  241. plumed/_lib/include/plumed/tools/Torsion.h +55 -0
  242. plumed/_lib/include/plumed/tools/TrajectoryParser.h +118 -0
  243. plumed/_lib/include/plumed/tools/Tree.h +61 -0
  244. plumed/_lib/include/plumed/tools/TypesafePtr.h +463 -0
  245. plumed/_lib/include/plumed/tools/Units.h +167 -0
  246. plumed/_lib/include/plumed/tools/Vector.h +433 -0
  247. plumed/_lib/include/plumed/tools/View.h +296 -0
  248. plumed/_lib/include/plumed/tools/View2D.h +100 -0
  249. plumed/_lib/include/plumed/tools/h36.h +39 -0
  250. plumed/_lib/include/plumed/vatom/ActionWithVirtualAtom.h +32 -0
  251. plumed/_lib/include/plumed/ves/BasisFunctions.h +380 -0
  252. plumed/_lib/include/plumed/ves/CoeffsBase.h +310 -0
  253. plumed/_lib/include/plumed/ves/CoeffsMatrix.h +220 -0
  254. plumed/_lib/include/plumed/ves/CoeffsVector.h +251 -0
  255. plumed/_lib/include/plumed/ves/FermiSwitchingFunction.h +74 -0
  256. plumed/_lib/include/plumed/ves/GridIntegrationWeights.h +50 -0
  257. plumed/_lib/include/plumed/ves/GridLinearInterpolation.h +81 -0
  258. plumed/_lib/include/plumed/ves/GridProjWeights.h +61 -0
  259. plumed/_lib/include/plumed/ves/LinearBasisSetExpansion.h +303 -0
  260. plumed/_lib/include/plumed/ves/Optimizer.h +444 -0
  261. plumed/_lib/include/plumed/ves/TargetDistModifer.h +53 -0
  262. plumed/_lib/include/plumed/ves/TargetDistribution.h +266 -0
  263. plumed/_lib/include/plumed/ves/VesBias.h +545 -0
  264. plumed/_lib/include/plumed/ves/VesTools.h +142 -0
  265. plumed/_lib/include/plumed/ves/WaveletGrid.h +75 -0
  266. plumed/_lib/include/plumed/volumes/ActionVolume.h +268 -0
  267. plumed/_lib/include/plumed/volumes/VolumeShortcut.h +147 -0
  268. plumed/_lib/include/plumed/wrapper/Plumed.h +5025 -0
  269. plumed/_lib/include/plumed/xdrfile/xdrfile.h +663 -0
  270. plumed/_lib/include/plumed/xdrfile/xdrfile_trr.h +89 -0
  271. plumed/_lib/include/plumed/xdrfile/xdrfile_xtc.h +90 -0
  272. plumed/_lib/lib/PythonCVInterface.dylib +0 -0
  273. plumed/_lib/lib/libplumed.dylib +0 -0
  274. plumed/_lib/lib/libplumedKernel.dylib +0 -0
  275. plumed/_lib/lib/libplumedWrapper.a +0 -0
  276. plumed/_lib/lib/pkgconfig/plumed.pc +13 -0
  277. plumed/_lib/lib/pkgconfig/plumedInternals.pc +13 -0
  278. plumed/_lib/lib/pkgconfig/plumedWrapper.pc +13 -0
  279. plumed/_lib/lib/plumed/fortran/plumed.f90 +879 -0
  280. plumed/_lib/lib/plumed/fortran/plumed_f08.f90 +2625 -0
  281. plumed/_lib/lib/plumed/modulefile +69 -0
  282. plumed/_lib/lib/plumed/patches/gromacs-2022.5.config +43 -0
  283. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt +543 -0
  284. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/CMakeLists.txt.preplumed +540 -0
  285. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp +1628 -0
  286. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1590 -0
  287. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h +103 -0
  288. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/expanded.h.preplumed +99 -0
  289. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp +2527 -0
  290. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2513 -0
  291. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  292. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  293. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +408 -0
  294. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +394 -0
  295. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp +2348 -0
  296. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2091 -0
  297. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp +3573 -0
  298. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3495 -0
  299. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1506 -0
  300. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1402 -0
  301. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  302. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  303. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp +997 -0
  304. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +906 -0
  305. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp +2780 -0
  306. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2738 -0
  307. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  308. plumed/_lib/lib/plumed/patches/gromacs-2022.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  309. plumed/_lib/lib/plumed/patches/gromacs-2023.5.config +43 -0
  310. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt +549 -0
  311. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/CMakeLists.txt.preplumed +546 -0
  312. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
  313. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
  314. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h +104 -0
  315. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
  316. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp +2624 -0
  317. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2610 -0
  318. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  319. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  320. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h +409 -0
  321. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +395 -0
  322. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp +2419 -0
  323. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/md.cpp.preplumed +2164 -0
  324. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp +3546 -0
  325. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3468 -0
  326. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
  327. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
  328. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  329. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  330. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp +991 -0
  331. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/rerun.cpp.preplumed +900 -0
  332. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp +2895 -0
  333. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/mdrun/runner.cpp.preplumed +2849 -0
  334. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  335. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  336. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp +886 -0
  337. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +880 -0
  338. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +347 -0
  339. plumed/_lib/lib/plumed/patches/gromacs-2023.5.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +345 -0
  340. plumed/_lib/lib/plumed/patches/gromacs-2024.3.config +43 -0
  341. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt +575 -0
  342. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/CMakeLists.txt.preplumed +572 -0
  343. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp +1632 -0
  344. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.cpp.preplumed +1594 -0
  345. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h +104 -0
  346. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/expanded.h.preplumed +100 -0
  347. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp +2564 -0
  348. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdlib/sim_util.cpp.preplumed +2550 -0
  349. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp +208 -0
  350. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.cpp.preplumed +175 -0
  351. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h +410 -0
  352. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/legacymdrunoptions.h.preplumed +396 -0
  353. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp +2435 -0
  354. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/md.cpp.preplumed +2187 -0
  355. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp +3592 -0
  356. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/minimize.cpp.preplumed +3514 -0
  357. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp +1513 -0
  358. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.cpp.preplumed +1409 -0
  359. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h +114 -0
  360. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/replicaexchange.h.preplumed +106 -0
  361. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp +958 -0
  362. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/rerun.cpp.preplumed +929 -0
  363. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp +2987 -0
  364. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/mdrun/runner.cpp.preplumed +2941 -0
  365. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp +224 -0
  366. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/modularsimulator/expandedensembleelement.cpp.preplumed +222 -0
  367. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp +904 -0
  368. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/decidegpuusage.cpp.preplumed +898 -0
  369. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h +353 -0
  370. plumed/_lib/lib/plumed/patches/gromacs-2024.3.diff/src/gromacs/taskassignment/include/gromacs/taskassignment/decidegpuusage.h.preplumed +351 -0
  371. plumed/_lib/lib/plumed/patches/gromacs-2025.0.config +39 -0
  372. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake +82 -0
  373. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/cmake/gmxManagePlumed.cmake.preplumed +82 -0
  374. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp +162 -0
  375. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedMDModule.cpp.preplumed +154 -0
  376. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp +107 -0
  377. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.cpp.preplumed +99 -0
  378. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h +120 -0
  379. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedOptions.h.preplumed +111 -0
  380. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp +215 -0
  381. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.cpp.preplumed +197 -0
  382. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h +87 -0
  383. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/applied_forces/plumed/plumedforceprovider.h.preplumed +86 -0
  384. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp +2971 -0
  385. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrun/runner.cpp.preplumed +2970 -0
  386. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h +430 -0
  387. plumed/_lib/lib/plumed/patches/gromacs-2025.0.diff/src/gromacs/mdrunutility/mdmodulesnotifiers.h.preplumed +429 -0
  388. plumed/_lib/lib/plumed/patches/namd-2.12.config +30 -0
  389. plumed/_lib/lib/plumed/patches/namd-2.12.diff +267 -0
  390. plumed/_lib/lib/plumed/patches/namd-2.13.config +30 -0
  391. plumed/_lib/lib/plumed/patches/namd-2.13.diff +267 -0
  392. plumed/_lib/lib/plumed/patches/namd-2.14.config +30 -0
  393. plumed/_lib/lib/plumed/patches/namd-2.14.diff +268 -0
  394. plumed/_lib/lib/plumed/patches/patch.sh +500 -0
  395. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.config +25 -0
  396. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90 +368 -0
  397. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/forces.f90.preplumed +366 -0
  398. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90 +71 -0
  399. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_forces.f90.preplumed +24 -0
  400. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90 +62 -0
  401. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  402. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90 +189 -0
  403. plumed/_lib/lib/plumed/patches/qespresso-5.0.2.diff/PW/src/pwscf.f90.preplumed +185 -0
  404. plumed/_lib/lib/plumed/patches/qespresso-6.2.config +26 -0
  405. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90 +422 -0
  406. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/forces.f90.preplumed +420 -0
  407. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90 +70 -0
  408. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  409. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90 +62 -0
  410. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  411. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90 +233 -0
  412. plumed/_lib/lib/plumed/patches/qespresso-6.2.diff/PW/src/run_pwscf.f90.preplumed +230 -0
  413. plumed/_lib/lib/plumed/patches/qespresso-7.0.config +28 -0
  414. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile +175 -0
  415. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/Modules/Makefile.preplumed +171 -0
  416. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90 +486 -0
  417. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/forces.f90.preplumed +484 -0
  418. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90 +74 -0
  419. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  420. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90 +64 -0
  421. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  422. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90 +532 -0
  423. plumed/_lib/lib/plumed/patches/qespresso-7.0.diff/PW/src/run_pwscf.f90.preplumed +518 -0
  424. plumed/_lib/lib/plumed/patches/qespresso-7.2.config +28 -0
  425. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile +249 -0
  426. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/Modules/Makefile.preplumed +244 -0
  427. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90 +532 -0
  428. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/forces.f90.preplumed +535 -0
  429. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90 +74 -0
  430. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_ext_forces.f90.preplumed +23 -0
  431. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90 +64 -0
  432. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/plugin_initialization.f90.preplumed +21 -0
  433. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90 +569 -0
  434. plumed/_lib/lib/plumed/patches/qespresso-7.2.diff/PW/src/run_pwscf.f90.preplumed +560 -0
  435. plumed/_lib/lib/plumed/plumed-config +9 -0
  436. plumed/_lib/lib/plumed/plumed-mklib +9 -0
  437. plumed/_lib/lib/plumed/plumed-newcv +9 -0
  438. plumed/_lib/lib/plumed/plumed-partial_tempering +9 -0
  439. plumed/_lib/lib/plumed/plumed-patch +9 -0
  440. plumed/_lib/lib/plumed/plumed-runtime +0 -0
  441. plumed/_lib/lib/plumed/plumed-selector +9 -0
  442. plumed/_lib/lib/plumed/plumed-vim2html +9 -0
  443. plumed/_lib/lib/plumed/scripts/config.sh +126 -0
  444. plumed/_lib/lib/plumed/scripts/mklib.sh +175 -0
  445. plumed/_lib/lib/plumed/scripts/newcv.sh +26 -0
  446. plumed/_lib/lib/plumed/scripts/partial_tempering.sh +319 -0
  447. plumed/_lib/lib/plumed/scripts/patch.sh +4 -0
  448. plumed/_lib/lib/plumed/scripts/selector.sh +234 -0
  449. plumed/_lib/lib/plumed/scripts/vim2html.sh +190 -0
  450. plumed/_lib/lib/plumed/src/colvar/Template.cpp +116 -0
  451. plumed/_lib/lib/plumed/src/config/compile_options.sh +3 -0
  452. plumed/_lib/lib/plumed/src/config/config.txt +181 -0
  453. plumed/_lib/lib/plumed/src/lib/Plumed.cmake +6 -0
  454. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.runtime +5 -0
  455. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.shared +5 -0
  456. plumed/_lib/lib/plumed/src/lib/Plumed.cmake.static +3 -0
  457. plumed/_lib/lib/plumed/src/lib/Plumed.inc +6 -0
  458. plumed/_lib/lib/plumed/src/lib/Plumed.inc.runtime +5 -0
  459. plumed/_lib/lib/plumed/src/lib/Plumed.inc.shared +5 -0
  460. plumed/_lib/lib/plumed/src/lib/Plumed.inc.static +3 -0
  461. plumed/_lib/lib/plumed/vim/scripts.vim +6 -0
  462. plumed/_plumed_core.cpython-311-darwin.so +0 -0
  463. plumed/_plumed_core.cpython-312-darwin.so +0 -0
  464. plumed/_plumed_core.cpython-313-darwin.so +0 -0
  465. plumedCommunications.cpython-311-darwin.so +0 -0
  466. plumedCommunications.cpython-312-darwin.so +0 -0
  467. plumedCommunications.cpython-313-darwin.so +0 -0
  468. plumedCommunications.pyi +431 -0
@@ -0,0 +1,1023 @@
1
+ /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
+ Copyright (c) 2017-2023 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_ParallelTaskManager_h
23
+ #define __PLUMED_core_ParallelTaskManager_h
24
+
25
+ #include "ActionWithVector.h"
26
+ #include "ActionWithMatrix.h"
27
+ #include "../tools/Communicator.h"
28
+ #include "../tools/OpenMP.h"
29
+ #include "../tools/View.h"
30
+ #include "../tools/View2D.h"
31
+
32
+ #include "../tools/ColvarOutput.h"
33
+ #include "../tools/OpenACC.h"
34
+
35
+ namespace PLMD {
36
+
37
+ struct ArgumentsBookkeeping {
38
+ std::size_t nargs{0};
39
+ std::vector<std::size_t> ranks;
40
+ std::vector<std::size_t> shapestarts;
41
+ std::vector<std::size_t> shapedata;
42
+ std::vector<std::size_t> ncols;
43
+ std::vector<std::size_t> bookstarts;
44
+ std::vector<std::size_t> booksizes;
45
+ std::vector<std::size_t> bookeeping;
46
+ std::vector<std::size_t> argstarts;
47
+ void setupArguments( const ActionWithArguments* action );
48
+ };
49
+
50
+ inline
51
+ void ArgumentsBookkeeping::setupArguments( const ActionWithArguments* action ) {
52
+ nargs = action->getNumberOfArguments();
53
+ ranks.resize( nargs );
54
+ shapestarts.resize( nargs );
55
+ argstarts.resize( nargs );
56
+ std::size_t s = 0;
57
+ std::size_t ts = 0;
58
+ for(unsigned i=0; i<nargs; ++i) {
59
+ Value* myarg = action->getPntrToArgument(i);
60
+ shapestarts[i] = ts;
61
+ ranks[i] = myarg->getRank();
62
+ ts += ranks[i];
63
+ argstarts[i] = s;
64
+ s += myarg->getNumberOfStoredValues();
65
+ }
66
+ shapedata.resize( ts );
67
+ ts = 0;
68
+ ncols.resize( nargs );
69
+ bookstarts.resize( nargs );
70
+ booksizes.resize( nargs );
71
+ std::size_t nbook = 0;
72
+ for(unsigned i=0; i<nargs; ++i) {
73
+ Value* myarg = action->getPntrToArgument(i);
74
+ for(unsigned j=0; j<ranks[i]; ++j) {
75
+ shapedata[ts] = myarg->getShape()[j];
76
+ ++ts;
77
+ }
78
+ bookstarts[i] = nbook;
79
+ if( ranks[i]==1 ) {
80
+ ncols[i] = 1;
81
+ booksizes[i] = 2*myarg->getShape()[0];
82
+ } else if( ranks[i]==2 ) {
83
+ ncols[i] = myarg->getNumberOfColumns();
84
+ booksizes[i] = myarg->matrix_bookeeping.size();
85
+ }
86
+ nbook += booksizes[i];
87
+ }
88
+ bookeeping.resize( nbook );
89
+ ts = 0;
90
+ for(unsigned i=0; i<nargs; ++i) {
91
+ Value* myarg = action->getPntrToArgument(i);
92
+ if( ranks[i]==1 ) {
93
+ for(unsigned j=0; j<myarg->getShape()[0]; ++j) {
94
+ bookeeping[ts] = 1;
95
+ bookeeping[ts+1] = 0;
96
+ ts += 2;
97
+ }
98
+ } else if( ranks[i]==2 ) {
99
+ for(unsigned j=0; j<myarg->matrix_bookeeping.size(); ++j) {
100
+ bookeeping[ts] = myarg->matrix_bookeeping[j];
101
+ ++ts;
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+ struct ParallelActionsInput {
108
+ /// Do we need to calculate the derivatives
109
+ bool noderiv{false};
110
+ /// Periodic boundary conditions
111
+ const Pbc* pbc;
112
+ /// The number of components the underlying action is computing
113
+ std::size_t ncomponents{0};
114
+ /// The number of scalars we are calculating for each task
115
+ unsigned nscalars{0};
116
+ /// The number of force scalars for each task
117
+ unsigned nforcescalars{0};
118
+ /// Number of derivatives for each scalar being calculated
119
+ std::size_t nderivatives_per_scalar{0};
120
+ /// The start of the thread unsafe forces
121
+ unsigned threadunsafe_forces_start{0};
122
+ /// This holds all the input data that is required to calculate all values for all tasks
123
+ unsigned dataSize{0};
124
+ double *inputdata{nullptr};
125
+ /// Bookeeping stuff for arguments
126
+ std::size_t nargs{0};
127
+ std::size_t ranks_size{0};
128
+ const std::size_t* ranks{nullptr};
129
+ std::size_t shapestarts_size{0};
130
+ const std::size_t* shapestarts{nullptr};
131
+ std::size_t shapedata_size{0};
132
+ const std::size_t* shapedata{nullptr};
133
+ std::size_t ncols_size{0};
134
+ const std::size_t* ncols{nullptr};
135
+ std::size_t bookstarts_size{0};
136
+ const std::size_t* bookstarts{nullptr};
137
+ std::size_t booksizes_size{0};
138
+ const std::size_t* booksizes{nullptr};
139
+ std::size_t bookeeping_size{0};
140
+ const std::size_t* bookeeping{nullptr};
141
+ std::size_t argstarts_size{0};
142
+ const std::size_t* argstarts{nullptr};
143
+ static ParallelActionsInput create( const Pbc& box ) {
144
+ auto toret=ParallelActionsInput();
145
+ toret.pbc=&box;
146
+ return toret;
147
+ }
148
+
149
+ //helper function to bring data to the device in a controlled way
150
+ void toACCDevice()const {
151
+ #pragma acc enter data copyin(this[0:1], noderiv, pbc[0:1],ncomponents, \
152
+ nscalars, nderivatives_per_scalar, threadunsafe_forces_start, \
153
+ dataSize, inputdata[0:dataSize])
154
+ if (nargs>0) {
155
+ #pragma acc enter data copyin( nargs, \
156
+ ranks_size, ranks[0:ranks_size], \
157
+ shapestarts_size, shapestarts[0:shapestarts_size], \
158
+ shapedata_size, shapedata[0:shapedata_size], \
159
+ ncols_size, ncols[0:ncols_size], \
160
+ bookstarts_size, bookstarts[0:bookstarts_size], \
161
+ booksizes_size, booksizes[0:booksizes_size], \
162
+ bookeeping_size, bookeeping[0:bookeeping_size], \
163
+ argstarts_size, argstarts[0:argstarts_size] \
164
+ )
165
+ }
166
+ pbc->toACCDevice();
167
+ }
168
+ //helper function to remove data from the device in a controlled way
169
+ void removeFromACCDevice() const {
170
+ pbc->removeFromACCDevice();
171
+ // assuming dataSize is not changed
172
+ if (nargs>0) {
173
+ #pragma acc exit data delete( \
174
+ shapestarts[0:shapestarts_size], shapestarts_size, \
175
+ shapedata[0:shapedata_size], shapedata_size, \
176
+ ncols[0:ncols_size], ncols_size, \
177
+ bookstarts[0:bookstarts_size], bookstarts_size, \
178
+ booksizes[0:booksizes_size], booksizes_size, \
179
+ bookeeping[0:bookeeping_size], bookeeping_size, \
180
+ argstarts[0:argstarts_size], argstarts_size, \
181
+ ranks[0:ranks_size], ranks_size, \
182
+ nargs )
183
+ }
184
+
185
+ #pragma acc exit data delete( \
186
+ inputdata[0:dataSize], dataSize, \
187
+ threadunsafe_forces_start, nderivatives_per_scalar, \
188
+ nscalars, ncomponents, pbc[0:1],noderiv,this[0:1])
189
+ }
190
+ /// Setup the arguments
191
+ void setupArguments( const ArgumentsBookkeeping& ab );
192
+ unsigned sizeOfFakeVals() const {
193
+ return nscalars;
194
+ }
195
+ };
196
+
197
+ inline void ParallelActionsInput::setupArguments( const ArgumentsBookkeeping& ab ) {
198
+ nargs = ab.nargs;
199
+ ranks = ab.ranks.data();
200
+ ranks_size = ab.ranks.size();
201
+ shapestarts = ab.shapestarts.data();
202
+ shapestarts_size = ab.shapestarts.size();
203
+ shapedata = ab.shapedata.data();
204
+ shapedata_size = ab.shapedata.size();
205
+ ncols = ab.ncols.data();
206
+ ncols_size = ab.ncols.size();
207
+ bookstarts = ab.bookstarts.data();
208
+ bookstarts_size = ab.bookstarts.size();
209
+ booksizes = ab.booksizes.data();
210
+ booksizes_size = ab.booksizes.size();
211
+ bookeeping = ab.bookeeping.data();
212
+ bookeeping_size = ab.bookeeping.size();
213
+ argstarts = ab.argstarts.data();
214
+ argstarts_size = ab.argstarts.size();
215
+ }
216
+
217
+ struct ArgumentBookeepingHolder {
218
+ std::size_t rank;
219
+ std::size_t ncols;
220
+ std::size_t start;
221
+ View<const std::size_t> shape;
222
+ View<const std::size_t> bookeeping;
223
+
224
+ static ArgumentBookeepingHolder create ( std::size_t argno, const ParallelActionsInput& inp ) {
225
+ return ArgumentBookeepingHolder{
226
+ inp.ranks[argno], // rank
227
+ inp.ncols[argno], // ncols
228
+ inp.argstarts[argno], // start
229
+ View<const std::size_t>(inp.shapedata + inp.shapestarts[argno], inp.ranks[argno] ), // shape
230
+ View<const std::size_t>(inp.bookeeping + inp.bookstarts[argno], inp.booksizes[argno] ) // bookeeping
231
+ };
232
+ }
233
+ };
234
+
235
+ struct ParallelActionsOutput {
236
+ View<double> values;
237
+ View<double> derivatives;
238
+ View<double> buffer;
239
+
240
+ static ParallelActionsOutput create( std::size_t ncomp, double* v, std::size_t ndev, double* d, std::size_t nb, double* b ) {
241
+ return ParallelActionsOutput{
242
+ View{v,ncomp}, //values
243
+ View{d,ndev}, // derivatives
244
+ View{b,nb} // buffer
245
+ };
246
+ }
247
+ };
248
+
249
+ struct ForceIndexHolder {
250
+ View<std::size_t> threadsafe_derivatives_end;
251
+ View<std::size_t> tot_indices;
252
+ View2D<std::size_t> indices;
253
+
254
+ /// Constructs a ForceIndexHolder object.
255
+ /// \param nc Definition here (number of components?)
256
+ /// \param nd Definition here (number of derivatives?)
257
+ /// \param ind Pointer to an array storing index data. It should have a size of at least 2*nc + nc*nd.
258
+ static ForceIndexHolder create(const std::size_t nc,
259
+ const std::size_t nd,
260
+ std::size_t* ind ) {
261
+ return ForceIndexHolder{
262
+ View{ind,nc}, // threadsafe_derivatives_end
263
+ View{ind+nc,nc}, // tot_indices
264
+ View2D{ind+2*nc,nc,nd} // indices
265
+ };
266
+ }
267
+ static ForceIndexHolder create(const ParallelActionsInput& inp,
268
+ std::size_t* ind ) {
269
+ return create(inp.ncomponents,
270
+ inp.nderivatives_per_scalar,ind);
271
+ }
272
+
273
+ /// \brief Returns the number of indexes needed by a ForceIndexHolder
274
+ /// for each scalar.
275
+ ///
276
+ /// \param nc Definition here (number of components?)
277
+ /// \param nd Definition here (number of derivatives?)
278
+ ///
279
+ /// \return the number of indexes needed by a ForceIndexHolder
280
+ /// for each scalar.
281
+ static size_t indexesPerScalar(const std::size_t nc, const std::size_t nd) {
282
+ return nc // threadsafe_derivatives_end
283
+ + nc // tot_indices
284
+ + nc*nd; // indices
285
+ }
286
+ static size_t indexesPerScalar(const ParallelActionsInput& inp) {
287
+ return indexesPerScalar(inp.ncomponents,
288
+ inp.nderivatives_per_scalar);
289
+ }
290
+ };
291
+
292
+ class ForceInput {
293
+ public:
294
+ View<double> force;
295
+ View2D<double> deriv;
296
+ static ForceInput create( std::size_t nv, double* f, std::size_t nd, double* d ) {
297
+ return ForceInput{
298
+ View{f,nv}, //force
299
+ View2D{d,nv,nd} //deriv
300
+ };
301
+ }
302
+ };
303
+
304
+ //There is no need to pass this as reference:
305
+ struct ForceOutput {
306
+ //I would suggest to invert the name or to be clearer
307
+ // like something that recalls that "thread_safe" will be need to be reducted (hence it is NOT thread safe)
308
+ View<double> thread_safe;
309
+ //these are the forces that we promise will not provoke races
310
+ View<double> thread_unsafe;
311
+ //const T* is a ptr to const T
312
+ //T* const is a conts ptr to a modifiable T
313
+ static ForceOutput create(std::vector<double>& reduced, std::vector<double>& notReduced) {
314
+ return ForceOutput{
315
+ View{reduced.data(),reduced.size()}, // thread_safe
316
+ View{notReduced.data(),notReduced.size()} // thread_unsafe
317
+ };
318
+ }
319
+ static ForceOutput create(double* reduced, size_t rs, double* notReduce, size_t nrsz) {
320
+ return ForceOutput{
321
+ View{reduced,rs}, // thread_safe
322
+ View{notReduce,nrsz} // thread_unsafe
323
+ };
324
+ }
325
+ };
326
+
327
+ // namespace PTMUtils {
328
+ // template<class, class = void>
329
+ // constexpr bool has_gatherForces_custom = false;
330
+ //
331
+ // //this verifies that T has a method gatherForces_custom that can be called with this signature
332
+ // template<class T>
333
+ // constexpr bool has_gatherForces_custom <
334
+ // T,
335
+ // std::void_t<
336
+ // decltype(T::gatherForces_custom(
337
+ // std::declval<unsigned >(),
338
+ // std::declval<size_t >(),
339
+ // std::declval<size_t >(),
340
+ // std::declval<const typename T::input_type & >(),
341
+ // std::declval<const ParallelActionsInput& >(),
342
+ // std::declval<View<unsigned> >(),
343
+ // std::declval<double *>(),
344
+ // std::declval<double *>(),
345
+ // std::declval<View<double> >()
346
+ // ))
347
+ // >
348
+ // > = true;
349
+ //
350
+ // template<class, class = void>
351
+ // constexpr bool has_gatherForces_GPU = false;
352
+ //
353
+ // //this verifies that T has a method gatherForces_custom that can be called with this signature
354
+ // template<class T>
355
+ // constexpr bool has_gatherForces_GPU <
356
+ // T,
357
+ // std::void_t<
358
+ // decltype(T::gatherForcesGPU(
359
+ // std::declval<unsigned >(),
360
+ // std::declval<const typename T::input_type & >(),
361
+ // std::declval<const ParallelActionsInput& >(),
362
+ // std::declval<const ForceInput& >(),
363
+ // std::declval<ForceOutput >()
364
+ // ))
365
+ // >
366
+ // > = true;
367
+ //
368
+ // /// If the template class has virialSize, otherwise is 9
369
+ // template<class, class=void>
370
+ // constexpr size_t virialSize = 9;
371
+ //
372
+ // template<class T>
373
+ // constexpr size_t virialSize<T, std::void_t<decltype(T::virialSize),
374
+ // //this ensures that T::virialSize is a static member
375
+ // std::enable_if_t<!std::is_member_pointer_v<decltype(&T::virialSize)>>
376
+ // >>
377
+ // = T::virialSize;
378
+ // } //namespace PTMUtils
379
+
380
+ template <class T>
381
+ class ParallelTaskManager {
382
+ public:
383
+ using input_type= typename T::input_type;
384
+ // static constexpr bool has_custom_gather=PTMUtils::has_gatherForces_custom<T>;
385
+ // static constexpr bool has_GPU_gather=PTMUtils::has_gatherForces_GPU<T>;
386
+ // static constexpr size_t virialSize = PTMUtils::virialSize<T>;
387
+ private:
388
+ /// The underlying action for which we are managing parallel tasks
389
+ ActionWithVector* action;
390
+ /// The MPI communicator
391
+ Communicator& comm;
392
+ /// Is this an action with matrix
393
+ bool ismatrix;
394
+ /// True if not using MPI for parllisation
395
+ bool serial;
396
+ /// Are we using acc for parallisation
397
+ bool useacc;
398
+ /// Number of derivatives calculated for each task
399
+ std::size_t nderivatives_per_task;
400
+ /// The number of forces on each thread
401
+ /// The number of forces on each thread
402
+ std::size_t nthreaded_forces;
403
+ /// This holds the values before we pass them to the value
404
+ std::vector<double> value_stash;
405
+ /// A tempory set of vectors for holding forces over threads
406
+ std::vector<std::vector<double> > omp_forces;
407
+ /// This structs is used to pass data between the parallel interface and the function caller
408
+ ParallelActionsInput myinput;
409
+ ArgumentsBookkeeping argumentsMap;
410
+ //this holds the data for myinput that will be passed though myinput
411
+ std::vector<double> input_buffer;
412
+ /// This holds tempory data that we use in performTask
413
+ std::size_t workspace_size;
414
+ /// This holds data for that the underlying action needs to do the calculation
415
+ input_type actiondata;
416
+ //// This is used internally to get the number of elements in the value stash
417
+ std::size_t getValueStashSize() const ;
418
+ /// This is used internally to gather the forces on the threads
419
+ void gatherThreads( ForceOutput forces );
420
+ public:
421
+ static void registerKeywords( Keywords& keys );
422
+ ParallelTaskManager(ActionWithVector* av);
423
+ /// Setup the parallel task manager the three arguments are
424
+ /// nder = number of derivatives per scalar
425
+ /// nforce_ts = number of forces that are modified by multiple tasks
426
+ void setupParallelTaskManager( std::size_t nder, std::size_t nforce_ts );
427
+ /// Copy the data from the underlying colvar into this parallel action
428
+ void setActionInput( const input_type& adata );
429
+ /// Creating the size of the workspace
430
+ void setWorkspaceSize( std::size_t size );
431
+ /// Get the action input so we can use it
432
+ input_type& getActionInput();
433
+ const input_type& getActionInput() const ;
434
+ /// Is the calculation running in serial
435
+ bool runInSerial() const {
436
+ return serial;
437
+ }
438
+ /// This runs all the tasks
439
+ void runAllTasks();
440
+ /// Apply the forces on the parallel object
441
+ void applyForces( std::vector<double>& forcesForApply );
442
+ /// This is used to gather forces that are thread safe
443
+ static void gatherThreadSafeForces( const ParallelActionsInput& input,
444
+ const ForceIndexHolder& force_indices,
445
+ const ForceInput& fdata,
446
+ View<double> forces );
447
+ /// This is used to gather forces that are not thread safe
448
+ static void gatherThreadUnsafeForces( const ParallelActionsInput& input,
449
+ const ForceIndexHolder& force_indices,
450
+ const ForceInput& fdata,
451
+ View<double> forces );
452
+ };
453
+
454
+ template <class T>
455
+ void ParallelTaskManager<T>::registerKeywords( Keywords& keys ) {
456
+ keys.addFlag("SERIAL",false,"do the calculation in serial. Do not parallelize");
457
+ keys.addFlag("USEGPU",false,"run this calculation on the GPU");
458
+ keys.addLinkInDocForFlag("USEGPU","gpu.md");
459
+ keys.addLinkInDocForFlag("SERIAL", "actions.md");
460
+ }
461
+
462
+ template <class T>
463
+ ParallelTaskManager<T>::ParallelTaskManager(ActionWithVector* av):
464
+ action(av),
465
+ comm(av->comm),
466
+ ismatrix(false),
467
+ useacc(false),
468
+ nderivatives_per_task(0),
469
+ nthreaded_forces(0),
470
+ myinput(ParallelActionsInput::create(av->getPbc())),
471
+ workspace_size(0) {
472
+ ActionWithMatrix* am=dynamic_cast<ActionWithMatrix*>(av);
473
+ if(am) {
474
+ ismatrix=true;
475
+ }
476
+ action->parseFlag("USEGPU",useacc);
477
+ #ifdef __PLUMED_USE_OPENACC
478
+ if( useacc ) {
479
+ action->log.printf(" using GPU to calculate this action\n");
480
+ }
481
+ #else
482
+ if( useacc ) {
483
+ action->error("cannot use USEGPU flag as PLUMED has not been compiled with openacc");
484
+ }
485
+ #endif
486
+ action->parseFlag("SERIAL",serial);
487
+ if( serial ) {
488
+ action->log.printf(" not using MPI to parallelise this action\n");
489
+ }
490
+ }
491
+
492
+ template <class T>
493
+ std::size_t ParallelTaskManager<T>::getValueStashSize() const {
494
+ std::size_t valuesize=0;
495
+ for(unsigned i=0; i<action->getNumberOfComponents(); ++i) {
496
+ const Value* mycomp = action->getConstPntrToComponent(i);
497
+ if( mycomp->hasDerivatives() ) {
498
+ valuesize += mycomp->getNumberOfStoredValues()*(1+action->getNumberOfDerivatives());
499
+ } else {
500
+ valuesize += mycomp->getNumberOfStoredValues();
501
+ }
502
+ }
503
+ return valuesize;
504
+ }
505
+
506
+
507
+ template <class T>
508
+ void ParallelTaskManager<T>::setupParallelTaskManager( std::size_t nder,
509
+ std::size_t nforce_ts ) {
510
+ plumed_massert( action->getNumberOfComponents()>0, "there should be some components wen you setup the index list" );
511
+ myinput.ncomponents = action->getNumberOfComponents();
512
+ unsigned ntasks=0;
513
+ action->getNumberOfTasks( ntasks );
514
+ myinput.nscalars = 0;
515
+ myinput.nforcescalars = 0;
516
+ for(unsigned i=0; i<myinput.ncomponents; ++i) {
517
+ if( (action->copyOutput(i))->hasDerivatives() ) {
518
+ myinput.nscalars += 1 + action->getNumberOfDerivatives();
519
+ myinput.nforcescalars += 1;
520
+ } else if( (action->copyOutput(i))->getRank()==1 ) {
521
+ myinput.nscalars += 1;
522
+ myinput.nforcescalars += 1;
523
+ } else if( (action->copyOutput(i))->getRank()==2 ) {
524
+ if( ntasks==(action->copyOutput(i))->getShape()[0] ) {
525
+ myinput.nscalars += (action->copyOutput(i))->getNumberOfColumns();
526
+ myinput.nforcescalars += (action->copyOutput(i))->getNumberOfColumns();
527
+ } else {
528
+ myinput.nscalars += 1;
529
+ myinput.nforcescalars += 1;
530
+ }
531
+ }
532
+ }
533
+ myinput.nderivatives_per_scalar = nder;
534
+ nderivatives_per_task = nder*myinput.nforcescalars;
535
+ value_stash.resize( getValueStashSize() );
536
+ myinput.threadunsafe_forces_start = action->getNumberOfForceDerivatives() - nforce_ts;
537
+ unsigned t=OpenMP::getNumThreads();
538
+ if( useacc ) {
539
+ t = 1;
540
+ }
541
+ omp_forces.resize(t);
542
+ for(unsigned i=0; i<t; ++i) {
543
+ omp_forces[i].resize(nforce_ts);
544
+ }
545
+ }
546
+
547
+ template <class T>
548
+ void ParallelTaskManager<T>::setActionInput( const input_type& adata ) {
549
+ actiondata=adata;
550
+ }
551
+
552
+ template <class T>
553
+ typename ParallelTaskManager<T>::input_type& ParallelTaskManager<T>::getActionInput() {
554
+ return actiondata;
555
+ }
556
+
557
+ template <class T>
558
+ const typename ParallelTaskManager<T>::input_type& ParallelTaskManager<T>::getActionInput() const {
559
+ return actiondata;
560
+ }
561
+
562
+ template <class T>
563
+ void ParallelTaskManager<T>::setWorkspaceSize( std::size_t size ) {
564
+ workspace_size = size;
565
+ }
566
+
567
+ #ifdef __PLUMED_USE_OPENACC
568
+ //use the __PLUMED_USE_OPENACC_TASKSMINE macro to debug the ptm ins a single file
569
+ //so that compiling witha a small modification will be faster (the ptm is included nearly everywhere)
570
+ #ifndef __PLUMED_USE_OPENACC_TASKSMINE
571
+ template <class T>
572
+ void runAllTasksACC(typename T::input_type actiondata,
573
+ ParallelActionsInput myinput,
574
+ std::vector<double>& value_stash,
575
+ const std::vector<unsigned> & partialTaskList,
576
+ const unsigned nactive_tasks,
577
+ const std::size_t nderivatives_per_task,
578
+ const std::size_t workspace_size
579
+ ) {
580
+ auto myinput_acc = OpenACC::fromToDataHelper(myinput);
581
+ auto actiondata_acc = OpenACC::fromToDataHelper(actiondata);
582
+
583
+ //template type is deduced
584
+ OpenACC::memoryManager vs{value_stash};
585
+ auto value_stash_data = vs.devicePtr();
586
+
587
+ OpenACC::memoryManager ptl{partialTaskList};
588
+ auto partialTaskList_data = ptl.devicePtr();
589
+
590
+ OpenACC::memoryManager<double> buff{workspace_size*nactive_tasks};
591
+
592
+ auto buffer = buff.devicePtr();
593
+ OpenACC::memoryManager<double> dev(nderivatives_per_task*nactive_tasks);
594
+ auto derivatives = dev.devicePtr();
595
+ #pragma acc parallel loop present(myinput, actiondata) \
596
+ copyin(nactive_tasks, \
597
+ nderivatives_per_task, \
598
+ workspace_size)\
599
+ deviceptr(derivatives, \
600
+ partialTaskList_data, \
601
+ value_stash_data, \
602
+ buffer) \
603
+ default(none)
604
+ for(unsigned i=0; i<nactive_tasks; ++i) {
605
+ std::size_t task_index = partialTaskList_data[i];
606
+ std::size_t val_pos = task_index*myinput.nscalars;
607
+ auto myout = ParallelActionsOutput::create (myinput.nscalars,
608
+ value_stash_data+val_pos,
609
+ nderivatives_per_task,
610
+ derivatives+nderivatives_per_task*i,
611
+ workspace_size,
612
+ (workspace_size>0)?
613
+ buffer+workspace_size*i
614
+ :nullptr );
615
+ // Calculate the stuff in the loop for this action
616
+ T::performTask( task_index, actiondata, myinput, myout );
617
+ }
618
+ vs.copyFromDevice(value_stash.data());
619
+ }
620
+ #else
621
+ template <class T>
622
+ void runAllTasksACC(typename T::input_type actiondata,
623
+ ParallelActionsInput myinput,
624
+ std::vector<double>& value_stash,
625
+ const std::vector<unsigned> & partialTaskList,
626
+ const unsigned nactive_tasks,
627
+ const std::size_t nderivatives_per_task,
628
+ const std::size_t workspace_size
629
+ ) ;
630
+ #endif //__PLUMED_USE_OPENACC_TASKSMINE
631
+ #endif //__PLUMED_USE_OPENACC
632
+
633
+ template <class T>
634
+ void ParallelTaskManager<T>::runAllTasks() {
635
+ // Get the list of active tasks
636
+ std::vector<unsigned> & partialTaskList( action->getListOfActiveTasks( action ) );
637
+ unsigned nactive_tasks=partialTaskList.size();
638
+ // Get all the input data so we can broadcast it to the GPU
639
+ myinput.noderiv = true;
640
+ for(unsigned i=0; i<action->getNumberOfComponents(); ++i) {
641
+ if( (action->getConstPntrToComponent(i))->hasDerivatives() ) {
642
+ myinput.noderiv=false;
643
+ break;
644
+ }
645
+ }
646
+ action->getInputData( input_buffer );
647
+ myinput.dataSize = input_buffer.size();
648
+ myinput.inputdata = input_buffer.data();
649
+ // Transfer all the bookeeping information about the arguments
650
+ argumentsMap.setupArguments( action );
651
+ myinput.setupArguments( argumentsMap );
652
+ // Reset the values at the start of the task loop
653
+ std::size_t totalvals=getValueStashSize();
654
+ if( value_stash.size()!=totalvals ) {
655
+ value_stash.resize(totalvals);
656
+ }
657
+ std::fill (value_stash.begin(),value_stash.end(), 0.0);
658
+ if( useacc ) {
659
+ #ifdef __PLUMED_USE_OPENACC
660
+ if (comm.Get_rank()== 0) {// no multigpu shenanigans until this works
661
+ runAllTasksACC<T>(
662
+ actiondata,
663
+ myinput,
664
+ value_stash,
665
+ partialTaskList,
666
+ nactive_tasks,
667
+ nderivatives_per_task,
668
+ workspace_size
669
+ );
670
+ }
671
+ comm.Bcast( value_stash.data(), value_stash.size(), 0);
672
+ #else
673
+ plumed_merror("cannot use USEGPU flag if PLUMED has not been compiled with openACC");
674
+ #endif
675
+ } else {
676
+ // Get the MPI details
677
+ unsigned stride=comm.Get_size();
678
+ unsigned rank=comm.Get_rank();
679
+ if(serial) {
680
+ stride=1;
681
+ rank=0;
682
+ }
683
+
684
+ // Get number of threads for OpenMP
685
+ unsigned nt=OpenMP::getNumThreads();
686
+ if( nt*stride*10>nactive_tasks ) {
687
+ nt=nactive_tasks/stride/10;
688
+ }
689
+ if( nt==0 ) {
690
+ nt=1;
691
+ }
692
+
693
+ #pragma omp parallel num_threads(nt)
694
+ {
695
+ std::vector<double> buffer( workspace_size );
696
+ std::vector<double> derivatives( nderivatives_per_task );
697
+ #pragma omp for nowait
698
+ for(unsigned i=rank; i<nactive_tasks; i+=stride) {
699
+ std::size_t task_index = partialTaskList[i];
700
+ std::size_t val_pos = task_index*myinput.nscalars;
701
+ auto myout = ParallelActionsOutput::create ( myinput.nscalars,
702
+ value_stash.data()+val_pos,
703
+ nderivatives_per_task,
704
+ derivatives.data(),
705
+ workspace_size,
706
+ buffer.data() );
707
+ // Calculate the stuff in the loop for this action
708
+ T::performTask( task_index, actiondata, myinput, myout );
709
+ }
710
+ }
711
+ // MPI Gather everything
712
+ if( !serial ) {
713
+ comm.Sum( value_stash );
714
+ }
715
+ }
716
+ // And transfer the value to the output values
717
+ action->transferStashToValues( partialTaskList, value_stash );
718
+ }
719
+
720
+ #ifdef __PLUMED_USE_OPENACC
721
+ //use the __PLUMED_USE_OPENACC_FORCESMINE macro to debug the ptm ins a single file
722
+ //so that compiling witha a small modification will be faster (the ptm is included nearly everywhere)
723
+ #ifndef __PLUMED_USE_OPENACC_FORCESMINE
724
+ template <class T>
725
+ void applyForcesWithACC(PLMD::View<double> forcesForApply,
726
+ typename T::input_type actiondata,
727
+ ParallelActionsInput myinput,
728
+ const std::vector<double>& value_stash,
729
+ const std::vector<unsigned> & partialTaskList,
730
+ const unsigned nactive_tasks,
731
+ const std::size_t nderivatives_per_task,
732
+ const std::size_t workspace_size
733
+ ) {
734
+ auto myinput_acc = OpenACC::fromToDataHelper(myinput);
735
+ auto actiondata_acc = OpenACC::fromToDataHelper(actiondata);
736
+
737
+ //template type is deduced
738
+ OpenACC::memoryManager vs{value_stash};
739
+ auto value_stash_data = vs.devicePtr();
740
+
741
+ OpenACC::memoryManager ptl{partialTaskList};
742
+ auto partialTaskList_data = ptl.devicePtr();
743
+
744
+ OpenACC::memoryManager ffa {forcesForApply};
745
+ auto forcesForApply_data = ffa.devicePtr();
746
+ const auto forcesForApply_size = ffa.size();
747
+ const auto nind_per_scalar = ForceIndexHolder::indexesPerScalar(myinput);
748
+ //nscalars is >=ncomponents (see setupParallelTaskManager )
749
+ const auto nind_per_task = nind_per_scalar*myinput.nscalars;
750
+
751
+ OpenACC::memoryManager<double> dev{nderivatives_per_task*nactive_tasks};
752
+ auto derivatives = dev.devicePtr();
753
+ OpenACC::memoryManager<std::size_t> ind{nind_per_task*nactive_tasks};
754
+ auto indices = ind.devicePtr();
755
+ OpenACC::memoryManager<double> vtmp{myinput.sizeOfFakeVals()*nactive_tasks};
756
+ auto valstmp = vtmp.devicePtr();
757
+ OpenACC::memoryManager<double> buff{workspace_size*nactive_tasks};
758
+ auto buffer = buff.devicePtr();
759
+
760
+ #define forces_indicesArg(taskID,scalarID) ForceIndexHolder::create(myinput, \
761
+ indices + taskID*nind_per_task + scalarID*nind_per_scalar)
762
+ #define derivativeDrift(taskID,scalarID) taskID*nderivatives_per_task \
763
+ + scalarID*myinput.ncomponents*myinput.nderivatives_per_scalar
764
+ #define stashDrift(taskID,scalarID) taskID*myinput.nscalars \
765
+ + scalarID*myinput.ncomponents
766
+
767
+ #pragma acc data present(myinput,actiondata) \
768
+ copyin(nactive_tasks, \
769
+ forcesForApply_size, \
770
+ nderivatives_per_task, nind_per_task,nind_per_scalar, \
771
+ workspace_size) \
772
+ deviceptr(derivatives, \
773
+ indices, \
774
+ value_stash_data, \
775
+ partialTaskList_data, \
776
+ forcesForApply_data, \
777
+ valstmp, \
778
+ buffer) \
779
+ default(none)
780
+ {
781
+ #pragma acc parallel loop
782
+ for(unsigned t=0; t<nactive_tasks; ++t) {
783
+ std::size_t task_index = partialTaskList_data[t];
784
+ auto myout = ParallelActionsOutput::create( myinput.nscalars,
785
+ valstmp+myinput.nscalars*t,
786
+ nderivatives_per_task,
787
+ derivatives+nderivatives_per_task*t,
788
+ workspace_size,
789
+ (workspace_size>0)?buffer+workspace_size*t:nullptr);
790
+ // Calculate the stuff in the loop for this action
791
+ T::performTask( task_index, actiondata, myinput, myout );
792
+ // If this is a matrix this returns a number that isn't one as we have to loop over the columns
793
+ const std::size_t nvpt = T::getNumberOfValuesPerTask( task_index, actiondata );
794
+ #pragma acc loop seq
795
+ for(unsigned vID=0; vID<nvpt; ++vID) {
796
+ auto force_indices = forces_indicesArg(t,vID);
797
+ // Create a force index holder
798
+ // Get the indices for forces
799
+ T::getForceIndices( task_index,
800
+ vID,
801
+ forcesForApply_size,
802
+ actiondata,
803
+ myinput,
804
+ force_indices );
805
+
806
+ // Create a force input object
807
+ auto finput = ForceInput::create ( myinput.nscalars,
808
+ value_stash_data + stashDrift(task_index,vID),
809
+ myinput.nderivatives_per_scalar,
810
+ derivatives + derivativeDrift(t,vID));
811
+
812
+ // Gather forces that can be gathered locally
813
+ ParallelTaskManager<T>::gatherThreadSafeForces( myinput,
814
+ force_indices,
815
+ finput,
816
+ View<double>(forcesForApply_data,
817
+ forcesForApply_size));
818
+ }
819
+ }
820
+
821
+ #pragma acc parallel loop
822
+ for(unsigned v=myinput.threadunsafe_forces_start; v<forcesForApply_size; ++v) {
823
+ double tmp = 0.0;
824
+ #pragma acc loop reduction(+:tmp)
825
+ for(unsigned t=0; t<nactive_tasks; ++t) {
826
+ const std::size_t task_index = partialTaskList_data[t];
827
+ const std::size_t nvpt = T::getNumberOfValuesPerTask( task_index, actiondata );
828
+ for(unsigned vID=0; vID<nvpt; ++vID) {
829
+ auto force_indices = forces_indicesArg(t,vID);
830
+
831
+ auto fdata = ForceInput::create( myinput.nscalars,
832
+ value_stash_data + stashDrift(task_index,vID),
833
+ myinput.nderivatives_per_scalar,
834
+ derivatives + derivativeDrift(t,vID));
835
+ for(unsigned i=0; i<myinput.ncomponents; ++i) {
836
+ const double ff = fdata.force[i];
837
+ for(unsigned d=force_indices.threadsafe_derivatives_end[i];
838
+ d<force_indices.tot_indices[i]; ++d) {
839
+ if( force_indices.indices[i][d]==v ) {
840
+ tmp += ff*fdata.deriv[i][d];
841
+ // break;
842
+ }
843
+ }
844
+ }
845
+ }
846
+ }
847
+ forcesForApply_data[v] = tmp;
848
+ }
849
+ }
850
+ #undef forces_indicesArg
851
+ #undef derivativeDrift
852
+ #undef stashDrift
853
+ ffa.copyFromDevice(forcesForApply.data());
854
+ }
855
+ #else
856
+ template <class T>
857
+ void applyForcesWithACC(PLMD::View<double> forcesForApply,
858
+ typename T::input_type actiondata,
859
+ ParallelActionsInput myinput,
860
+ const std::vector<double>& value_stash,
861
+ const std::vector<unsigned> & partialTaskList,
862
+ const unsigned nactive_tasks,
863
+ const std::size_t nderivatives_per_task,
864
+ const std::size_t workspace_size
865
+ );
866
+ #endif //__PLUMED_USE_OPENACC_FORCESMINE
867
+ #endif //__PLUMED_USE_OPENACC
868
+ template <class T>
869
+ void ParallelTaskManager<T>::applyForces( std::vector<double>& forcesForApply ) {
870
+ // Get the list of active tasks
871
+ std::vector<unsigned> & partialTaskList= action->getListOfActiveTasks( action ) ;
872
+ unsigned nactive_tasks=partialTaskList.size();
873
+ // Clear force buffer
874
+ forcesForApply.assign( forcesForApply.size(), 0.0 );
875
+ //TODO: check if std::fill is faster (i get conflicting answers on the net)
876
+ //std::fill (forcesForApply.begin(),forcesForApply.end(), 0.0);
877
+ // Get all the input data so we can broadcast it to the GPU
878
+ myinput.noderiv = false;
879
+ // Retrieve the forces from the values
880
+ action->transferForcesToStash( partialTaskList, value_stash );
881
+
882
+ if( useacc ) {
883
+ #ifdef __PLUMED_USE_OPENACC
884
+ std::fill (omp_forces[0].begin(),omp_forces[0].end(), 0.0);
885
+ if (comm.Get_rank() == 0) {
886
+ applyForcesWithACC<T>(
887
+ PLMD::View<double> { forcesForApply.data(), forcesForApply.size() },
888
+ actiondata,
889
+ myinput,
890
+ value_stash,
891
+ partialTaskList,
892
+ nactive_tasks,
893
+ nderivatives_per_task,
894
+ workspace_size
895
+ );
896
+ }
897
+ #else
898
+ plumed_merror("cannot use USEGPU flag if PLUMED has not been compiled with openACC");
899
+ #endif
900
+ } else {
901
+ // Get the MPI details
902
+ unsigned stride=comm.Get_size();
903
+ unsigned rank=comm.Get_rank();
904
+ if(serial) {
905
+ stride=1;
906
+ rank=0;
907
+ }
908
+
909
+ // Get number of threads for OpenMP
910
+ unsigned nt=OpenMP::getNumThreads();
911
+ if( nt*stride*10>nactive_tasks ) {
912
+ nt=nactive_tasks/stride/10;
913
+ }
914
+ if( nt==0 ) {
915
+ nt=1;
916
+ }
917
+ #pragma omp parallel num_threads(nt)
918
+ {
919
+ const unsigned t=OpenMP::getThreadNum();
920
+ omp_forces[t].assign( omp_forces[t].size(), 0.0 );
921
+ std::vector<double> buffer( workspace_size );
922
+ std::vector<double> fake_vals( myinput.sizeOfFakeVals() );
923
+ std::vector<double> derivatives( nderivatives_per_task );
924
+ std::vector<std::size_t> indices(ForceIndexHolder::indexesPerScalar(myinput));
925
+
926
+ auto force_indices = ForceIndexHolder::create( myinput,indices.data() );
927
+ #pragma omp for nowait
928
+ for(unsigned i=rank; i<nactive_tasks; i+=stride) {
929
+ std::size_t task_index = partialTaskList[i];
930
+ auto myout = ParallelActionsOutput::create( myinput.nscalars,
931
+ fake_vals.data(),
932
+ derivatives.size(),
933
+ derivatives.data(),
934
+ workspace_size,
935
+ buffer.data() );
936
+ // Calculate the stuff in the loop for this action
937
+ T::performTask( task_index, actiondata, myinput, myout );
938
+
939
+ // If this is a matrix this returns a number that isn't one as we have to loop over the columns
940
+ const std::size_t nvpt = T::getNumberOfValuesPerTask( task_index, actiondata );
941
+ for(unsigned j=0; j<nvpt; ++j) {
942
+ // Get the force indices
943
+ T::getForceIndices( task_index,
944
+ j,
945
+ forcesForApply.size(),
946
+ actiondata,
947
+ myinput,
948
+ force_indices );
949
+ // Create a force input object
950
+ auto finput=ForceInput::create( myinput.nforcescalars,
951
+ value_stash.data()
952
+ + myinput.nforcescalars*task_index
953
+ + j*myinput.ncomponents,
954
+ myinput.nderivatives_per_scalar,
955
+ derivatives.data()
956
+ + j*myinput.ncomponents*myinput.nderivatives_per_scalar );
957
+
958
+ // Gather forces that are thread safe
959
+ gatherThreadSafeForces( myinput,
960
+ force_indices,
961
+ finput,
962
+ View<double>(forcesForApply.data(),
963
+ forcesForApply.size()) );
964
+
965
+ // Gather forces that are not thread safe
966
+ gatherThreadUnsafeForces( myinput,
967
+ force_indices,
968
+ finput,
969
+ View<double>(omp_forces[t].data(),
970
+ omp_forces[t].size()) );
971
+ }
972
+ }
973
+
974
+ #pragma omp critical
975
+ gatherThreads( ForceOutput::create(omp_forces[t], forcesForApply ) );
976
+ }
977
+ // MPI Gather everything (this must be extended to the gpu thing, after makning it mpi-aware)
978
+ if( !serial ) {
979
+ comm.Sum( forcesForApply );
980
+ }
981
+ }
982
+ }
983
+
984
+ template <class T>
985
+ void ParallelTaskManager<T>::gatherThreadSafeForces( const ParallelActionsInput& input,
986
+ const ForceIndexHolder& force_indices,
987
+ const ForceInput& fdata,
988
+ View<double> forces ) {
989
+ for(unsigned i=0; i<input.ncomponents; ++i) {
990
+ double ff = fdata.force[i];
991
+ for(unsigned j=0; j<force_indices.threadsafe_derivatives_end[i]; ++j) {
992
+ forces[ force_indices.indices[i][j] ] += ff*fdata.deriv[i][j];
993
+ }
994
+ }
995
+ }
996
+
997
+ template <class T>
998
+ void ParallelTaskManager<T>::gatherThreadUnsafeForces(const ParallelActionsInput& input,
999
+ const ForceIndexHolder& force_indices,
1000
+ const ForceInput& fdata,
1001
+ View<double> forces ) {
1002
+ for(unsigned i=0; i<input.ncomponents; ++i) {
1003
+ const double ff = fdata.force[i];
1004
+ for(unsigned d=force_indices.threadsafe_derivatives_end[i];
1005
+ d<force_indices.tot_indices[i]; ++d) {
1006
+ forces[ force_indices.indices[i][d] - input.threadunsafe_forces_start ]
1007
+ += ff*fdata.deriv[i][d];
1008
+ }
1009
+ }
1010
+ }
1011
+
1012
+ template <class T>
1013
+ void ParallelTaskManager<T>::gatherThreads( ForceOutput forces ) {
1014
+ //Forceoutput is basically two spans, so it is ok to pass it by value
1015
+ unsigned k=0;
1016
+ for(unsigned n=forces.thread_unsafe.size()-forces.thread_safe.size(); n<forces.thread_unsafe.size(); ++n) {
1017
+ forces.thread_unsafe[n] += forces.thread_safe[k];
1018
+ ++k;
1019
+ }
1020
+ }
1021
+
1022
+ } // namespace PLMD
1023
+ #endif