Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
f15f591b
Commit
f15f591b
authored
Feb 14, 2018
by
Peter Eastman
Browse files
Continuing to convert CudaArrays.
parent
b8c86406
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
430 additions
and
598 deletions
+430
-598
platforms/cuda/include/CudaKernels.h
platforms/cuda/include/CudaKernels.h
+86
-98
platforms/cuda/src/CudaBondedUtilities.cpp
platforms/cuda/src/CudaBondedUtilities.cpp
+5
-4
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+339
-496
No files found.
platforms/cuda/include/CudaKernels.h
View file @
f15f591b
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-201
7
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
8
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -265,9 +265,8 @@ private:
...
@@ -265,9 +265,8 @@ private:
class
CudaCalcHarmonicBondForceKernel
:
public
CalcHarmonicBondForceKernel
{
class
CudaCalcHarmonicBondForceKernel
:
public
CalcHarmonicBondForceKernel
{
public:
public:
CudaCalcHarmonicBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcHarmonicBondForceKernel
(
name
,
platform
),
CudaCalcHarmonicBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcHarmonicBondForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
,
params
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
{
}
}
~
CudaCalcHarmonicBondForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -298,7 +297,7 @@ private:
...
@@ -298,7 +297,7 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaArray
*
params
;
CudaArray
params
;
};
};
/**
/**
...
@@ -307,7 +306,7 @@ private:
...
@@ -307,7 +306,7 @@ private:
class
CudaCalcCustomBondForceKernel
:
public
CalcCustomBondForceKernel
{
class
CudaCalcCustomBondForceKernel
:
public
CalcCustomBondForceKernel
{
public:
public:
CudaCalcCustomBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomBondForceKernel
(
name
,
platform
),
CudaCalcCustomBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomBondForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
,
globals
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
}
~
CudaCalcCustomBondForceKernel
();
~
CudaCalcCustomBondForceKernel
();
/**
/**
...
@@ -341,7 +340,7 @@ private:
...
@@ -341,7 +340,7 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
};
};
...
@@ -352,9 +351,8 @@ private:
...
@@ -352,9 +351,8 @@ private:
class
CudaCalcHarmonicAngleForceKernel
:
public
CalcHarmonicAngleForceKernel
{
class
CudaCalcHarmonicAngleForceKernel
:
public
CalcHarmonicAngleForceKernel
{
public:
public:
CudaCalcHarmonicAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcHarmonicAngleForceKernel
(
name
,
platform
),
CudaCalcHarmonicAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcHarmonicAngleForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
,
params
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
{
}
}
~
CudaCalcHarmonicAngleForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -385,7 +383,7 @@ private:
...
@@ -385,7 +383,7 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaArray
*
params
;
CudaArray
params
;
};
};
/**
/**
...
@@ -394,7 +392,7 @@ private:
...
@@ -394,7 +392,7 @@ private:
class
CudaCalcCustomAngleForceKernel
:
public
CalcCustomAngleForceKernel
{
class
CudaCalcCustomAngleForceKernel
:
public
CalcCustomAngleForceKernel
{
public:
public:
CudaCalcCustomAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomAngleForceKernel
(
name
,
platform
),
CudaCalcCustomAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomAngleForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
,
globals
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
}
~
CudaCalcCustomAngleForceKernel
();
~
CudaCalcCustomAngleForceKernel
();
/**
/**
...
@@ -428,7 +426,7 @@ private:
...
@@ -428,7 +426,7 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
};
};
...
@@ -439,9 +437,8 @@ private:
...
@@ -439,9 +437,8 @@ private:
class
CudaCalcPeriodicTorsionForceKernel
:
public
CalcPeriodicTorsionForceKernel
{
class
CudaCalcPeriodicTorsionForceKernel
:
public
CalcPeriodicTorsionForceKernel
{
public:
public:
CudaCalcPeriodicTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcPeriodicTorsionForceKernel
(
name
,
platform
),
CudaCalcPeriodicTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcPeriodicTorsionForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
,
params
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
{
}
}
~
CudaCalcPeriodicTorsionForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -472,7 +469,7 @@ private:
...
@@ -472,7 +469,7 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaArray
*
params
;
CudaArray
params
;
};
};
/**
/**
...
@@ -481,9 +478,8 @@ private:
...
@@ -481,9 +478,8 @@ private:
class
CudaCalcRBTorsionForceKernel
:
public
CalcRBTorsionForceKernel
{
class
CudaCalcRBTorsionForceKernel
:
public
CalcRBTorsionForceKernel
{
public:
public:
CudaCalcRBTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcRBTorsionForceKernel
(
name
,
platform
),
CudaCalcRBTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcRBTorsionForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
,
params1
(
NULL
),
params2
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
{
}
}
~
CudaCalcRBTorsionForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -514,8 +510,8 @@ private:
...
@@ -514,8 +510,8 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaArray
*
params1
;
CudaArray
params1
;
CudaArray
*
params2
;
CudaArray
params2
;
};
};
/**
/**
...
@@ -524,9 +520,8 @@ private:
...
@@ -524,9 +520,8 @@ private:
class
CudaCalcCMAPTorsionForceKernel
:
public
CalcCMAPTorsionForceKernel
{
class
CudaCalcCMAPTorsionForceKernel
:
public
CalcCMAPTorsionForceKernel
{
public:
public:
CudaCalcCMAPTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCMAPTorsionForceKernel
(
name
,
platform
),
CudaCalcCMAPTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCMAPTorsionForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
,
coefficients
(
NULL
),
mapPositions
(
NULL
),
torsionMaps
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
)
{
}
}
~
CudaCalcCMAPTorsionForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -558,9 +553,9 @@ private:
...
@@ -558,9 +553,9 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
std
::
vector
<
int2
>
mapPositionsVec
;
std
::
vector
<
int2
>
mapPositionsVec
;
CudaArray
*
coefficients
;
CudaArray
coefficients
;
CudaArray
*
mapPositions
;
CudaArray
mapPositions
;
CudaArray
*
torsionMaps
;
CudaArray
torsionMaps
;
};
};
/**
/**
...
@@ -569,7 +564,7 @@ private:
...
@@ -569,7 +564,7 @@ private:
class
CudaCalcCustomTorsionForceKernel
:
public
CalcCustomTorsionForceKernel
{
class
CudaCalcCustomTorsionForceKernel
:
public
CalcCustomTorsionForceKernel
{
public:
public:
CudaCalcCustomTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomTorsionForceKernel
(
name
,
platform
),
CudaCalcCustomTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomTorsionForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
,
globals
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
}
~
CudaCalcCustomTorsionForceKernel
();
~
CudaCalcCustomTorsionForceKernel
();
/**
/**
...
@@ -603,7 +598,7 @@ private:
...
@@ -603,7 +598,7 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
};
};
...
@@ -614,9 +609,7 @@ private:
...
@@ -614,9 +609,7 @@ private:
class
CudaCalcNonbondedForceKernel
:
public
CalcNonbondedForceKernel
{
class
CudaCalcNonbondedForceKernel
:
public
CalcNonbondedForceKernel
{
public:
public:
CudaCalcNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcNonbondedForceKernel
(
name
,
platform
),
CudaCalcNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcNonbondedForceKernel
(
name
,
platform
),
cu
(
cu
),
hasInitializedFFT
(
false
),
sigmaEpsilon
(
NULL
),
exceptionParams
(
NULL
),
cosSinSums
(
NULL
),
directPmeGrid
(
NULL
),
reciprocalPmeGrid
(
NULL
),
cu
(
cu
),
hasInitializedFFT
(
false
),
sort
(
NULL
),
dispersionFft
(
NULL
),
fft
(
NULL
),
pmeio
(
NULL
)
{
pmeBsplineModuliX
(
NULL
),
pmeBsplineModuliY
(
NULL
),
pmeBsplineModuliZ
(
NULL
),
pmeDispersionBsplineModuliX
(
NULL
),
pmeDispersionBsplineModuliY
(
NULL
),
pmeDispersionBsplineModuliZ
(
NULL
),
pmeAtomRange
(
NULL
),
pmeAtomGridIndex
(
NULL
),
pmeEnergyBuffer
(
NULL
),
sort
(
NULL
),
dispersionFft
(
NULL
),
fft
(
NULL
),
pmeio
(
NULL
)
{
}
}
~
CudaCalcNonbondedForceKernel
();
~
CudaCalcNonbondedForceKernel
();
/**
/**
...
@@ -682,20 +675,20 @@ private:
...
@@ -682,20 +675,20 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
bool
hasInitializedFFT
;
bool
hasInitializedFFT
;
CudaArray
*
sigmaEpsilon
;
CudaArray
sigmaEpsilon
;
CudaArray
*
exceptionParams
;
CudaArray
exceptionParams
;
CudaArray
*
cosSinSums
;
CudaArray
cosSinSums
;
CudaArray
*
directPmeGrid
;
CudaArray
directPmeGrid
;
CudaArray
*
reciprocalPmeGrid
;
CudaArray
reciprocalPmeGrid
;
CudaArray
*
pmeBsplineModuliX
;
CudaArray
pmeBsplineModuliX
;
CudaArray
*
pmeBsplineModuliY
;
CudaArray
pmeBsplineModuliY
;
CudaArray
*
pmeBsplineModuliZ
;
CudaArray
pmeBsplineModuliZ
;
CudaArray
*
pmeDispersionBsplineModuliX
;
CudaArray
pmeDispersionBsplineModuliX
;
CudaArray
*
pmeDispersionBsplineModuliY
;
CudaArray
pmeDispersionBsplineModuliY
;
CudaArray
*
pmeDispersionBsplineModuliZ
;
CudaArray
pmeDispersionBsplineModuliZ
;
CudaArray
*
pmeAtomRange
;
CudaArray
pmeAtomRange
;
CudaArray
*
pmeAtomGridIndex
;
CudaArray
pmeAtomGridIndex
;
CudaArray
*
pmeEnergyBuffer
;
CudaArray
pmeEnergyBuffer
;
CudaSort
*
sort
;
CudaSort
*
sort
;
Kernel
cpuPme
;
Kernel
cpuPme
;
PmeIO
*
pmeio
;
PmeIO
*
pmeio
;
...
@@ -737,7 +730,7 @@ private:
...
@@ -737,7 +730,7 @@ private:
class
CudaCalcCustomNonbondedForceKernel
:
public
CalcCustomNonbondedForceKernel
{
class
CudaCalcCustomNonbondedForceKernel
:
public
CalcCustomNonbondedForceKernel
{
public:
public:
CudaCalcCustomNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomNonbondedForceKernel
(
name
,
platform
),
CudaCalcCustomNonbondedForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomNonbondedForceKernel
(
name
,
platform
),
cu
(
cu
),
params
(
NULL
),
globals
(
NULL
),
interactionGroupData
(
NULL
),
forceCopy
(
NULL
),
system
(
system
),
hasInitializedKernel
(
false
)
{
cu
(
cu
),
params
(
NULL
),
forceCopy
(
NULL
),
system
(
system
),
hasInitializedKernel
(
false
)
{
}
}
~
CudaCalcCustomNonbondedForceKernel
();
~
CudaCalcCustomNonbondedForceKernel
();
/**
/**
...
@@ -769,13 +762,13 @@ private:
...
@@ -769,13 +762,13 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
CudaArray
*
interactionGroupData
;
CudaArray
interactionGroupData
;
CUfunction
interactionGroupKernel
;
CUfunction
interactionGroupKernel
;
std
::
vector
<
void
*>
interactionGroupArgs
;
std
::
vector
<
void
*>
interactionGroupArgs
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
double
longRangeCoefficient
;
double
longRangeCoefficient
;
std
::
vector
<
double
>
longRangeCoefficientDerivs
;
std
::
vector
<
double
>
longRangeCoefficientDerivs
;
bool
hasInitializedLongRangeCorrection
,
hasInitializedKernel
,
hasParamDerivs
;
bool
hasInitializedLongRangeCorrection
,
hasInitializedKernel
,
hasParamDerivs
;
...
@@ -790,9 +783,8 @@ private:
...
@@ -790,9 +783,8 @@ private:
class
CudaCalcGBSAOBCForceKernel
:
public
CalcGBSAOBCForceKernel
{
class
CudaCalcGBSAOBCForceKernel
:
public
CalcGBSAOBCForceKernel
{
public:
public:
CudaCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
)
:
CalcGBSAOBCForceKernel
(
name
,
platform
),
cu
(
cu
),
CudaCalcGBSAOBCForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
)
:
CalcGBSAOBCForceKernel
(
name
,
platform
),
cu
(
cu
),
hasCreatedKernels
(
false
)
,
params
(
NULL
),
bornSum
(
NULL
),
bornRadii
(
NULL
),
bornForce
(
NULL
),
obcChain
(
NULL
)
{
hasCreatedKernels
(
false
)
{
}
}
~
CudaCalcGBSAOBCForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -823,11 +815,11 @@ private:
...
@@ -823,11 +815,11 @@ private:
int
maxTiles
;
int
maxTiles
;
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
CudaArray
*
params
;
CudaArray
params
;
CudaArray
*
bornSum
;
CudaArray
bornSum
;
CudaArray
*
bornRadii
;
CudaArray
bornRadii
;
CudaArray
*
bornForce
;
CudaArray
bornForce
;
CudaArray
*
obcChain
;
CudaArray
obcChain
;
CUfunction
computeBornSumKernel
;
CUfunction
computeBornSumKernel
;
CUfunction
reduceBornSumKernel
;
CUfunction
reduceBornSumKernel
;
CUfunction
force1Kernel
;
CUfunction
force1Kernel
;
...
@@ -841,8 +833,7 @@ private:
...
@@ -841,8 +833,7 @@ private:
class
CudaCalcCustomGBForceKernel
:
public
CalcCustomGBForceKernel
{
class
CudaCalcCustomGBForceKernel
:
public
CalcCustomGBForceKernel
{
public:
public:
CudaCalcCustomGBForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomGBForceKernel
(
name
,
platform
),
CudaCalcCustomGBForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomGBForceKernel
(
name
,
platform
),
hasInitializedKernels
(
false
),
cu
(
cu
),
params
(
NULL
),
computedValues
(
NULL
),
energyDerivs
(
NULL
),
energyDerivChain
(
NULL
),
longEnergyDerivs
(
NULL
),
globals
(
NULL
),
hasInitializedKernels
(
false
),
cu
(
cu
),
params
(
NULL
),
computedValues
(
NULL
),
energyDerivs
(
NULL
),
energyDerivChain
(
NULL
),
system
(
system
)
{
valueBuffers
(
NULL
),
system
(
system
)
{
}
}
~
CudaCalcCustomGBForceKernel
();
~
CudaCalcCustomGBForceKernel
();
/**
/**
...
@@ -880,13 +871,13 @@ private:
...
@@ -880,13 +871,13 @@ private:
CudaParameterSet
*
energyDerivs
;
CudaParameterSet
*
energyDerivs
;
CudaParameterSet
*
energyDerivChain
;
CudaParameterSet
*
energyDerivChain
;
std
::
vector
<
CudaParameterSet
*>
dValuedParam
;
std
::
vector
<
CudaParameterSet
*>
dValuedParam
;
std
::
vector
<
CudaArray
*
>
dValue0dParam
;
std
::
vector
<
CudaArray
>
dValue0dParam
;
CudaArray
*
longEnergyDerivs
;
CudaArray
longEnergyDerivs
;
CudaArray
*
globals
;
CudaArray
globals
;
CudaArray
*
valueBuffers
;
CudaArray
valueBuffers
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
std
::
vector
<
bool
>
pairValueUsesParam
,
pairEnergyUsesParam
,
pairEnergyUsesValue
;
std
::
vector
<
bool
>
pairValueUsesParam
,
pairEnergyUsesParam
,
pairEnergyUsesValue
;
const
System
&
system
;
const
System
&
system
;
CUfunction
pairValueKernel
,
perParticleValueKernel
,
pairEnergyKernel
,
perParticleEnergyKernel
,
gradientChainRuleKernel
;
CUfunction
pairValueKernel
,
perParticleValueKernel
,
pairEnergyKernel
,
perParticleEnergyKernel
,
gradientChainRuleKernel
;
...
@@ -901,7 +892,7 @@ private:
...
@@ -901,7 +892,7 @@ private:
class
CudaCalcCustomExternalForceKernel
:
public
CalcCustomExternalForceKernel
{
class
CudaCalcCustomExternalForceKernel
:
public
CalcCustomExternalForceKernel
{
public:
public:
CudaCalcCustomExternalForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomExternalForceKernel
(
name
,
platform
),
CudaCalcCustomExternalForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomExternalForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
,
globals
(
NULL
)
{
hasInitializedKernel
(
false
),
cu
(
cu
),
system
(
system
),
params
(
NULL
)
{
}
}
~
CudaCalcCustomExternalForceKernel
();
~
CudaCalcCustomExternalForceKernel
();
/**
/**
...
@@ -935,7 +926,7 @@ private:
...
@@ -935,7 +926,7 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
const
System
&
system
;
const
System
&
system
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
};
};
...
@@ -946,8 +937,7 @@ private:
...
@@ -946,8 +937,7 @@ private:
class
CudaCalcCustomHbondForceKernel
:
public
CalcCustomHbondForceKernel
{
class
CudaCalcCustomHbondForceKernel
:
public
CalcCustomHbondForceKernel
{
public:
public:
CudaCalcCustomHbondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomHbondForceKernel
(
name
,
platform
),
CudaCalcCustomHbondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomHbondForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
donorParams
(
NULL
),
acceptorParams
(
NULL
),
donors
(
NULL
),
acceptors
(
NULL
),
hasInitializedKernel
(
false
),
cu
(
cu
),
donorParams
(
NULL
),
acceptorParams
(
NULL
),
system
(
system
)
{
globals
(
NULL
),
donorExclusions
(
NULL
),
acceptorExclusions
(
NULL
),
system
(
system
)
{
}
}
~
CudaCalcCustomHbondForceKernel
();
~
CudaCalcCustomHbondForceKernel
();
/**
/**
...
@@ -981,14 +971,14 @@ private:
...
@@ -981,14 +971,14 @@ private:
ForceInfo
*
info
;
ForceInfo
*
info
;
CudaParameterSet
*
donorParams
;
CudaParameterSet
*
donorParams
;
CudaParameterSet
*
acceptorParams
;
CudaParameterSet
*
acceptorParams
;
CudaArray
*
globals
;
CudaArray
globals
;
CudaArray
*
donors
;
CudaArray
donors
;
CudaArray
*
acceptors
;
CudaArray
acceptors
;
CudaArray
*
donorExclusions
;
CudaArray
donorExclusions
;
CudaArray
*
acceptorExclusions
;
CudaArray
acceptorExclusions
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
std
::
vector
<
void
*>
donorArgs
,
acceptorArgs
;
std
::
vector
<
void
*>
donorArgs
,
acceptorArgs
;
const
System
&
system
;
const
System
&
system
;
CUfunction
donorKernel
,
acceptorKernel
;
CUfunction
donorKernel
,
acceptorKernel
;
...
@@ -1000,7 +990,7 @@ private:
...
@@ -1000,7 +990,7 @@ private:
class
CudaCalcCustomCentroidBondForceKernel
:
public
CalcCustomCentroidBondForceKernel
{
class
CudaCalcCustomCentroidBondForceKernel
:
public
CalcCustomCentroidBondForceKernel
{
public:
public:
CudaCalcCustomCentroidBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomCentroidBondForceKernel
(
name
,
platform
),
CudaCalcCustomCentroidBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomCentroidBondForceKernel
(
name
,
platform
),
cu
(
cu
),
params
(
NULL
),
globals
(
NULL
),
groupParticles
(
NULL
),
groupWeights
(
NULL
),
groupOffsets
(
NULL
),
groupForces
(
NULL
),
bondGroups
(
NULL
),
centerPositions
(
NULL
),
system
(
system
)
{
cu
(
cu
),
params
(
NULL
),
system
(
system
)
{
}
}
~
CudaCalcCustomCentroidBondForceKernel
();
~
CudaCalcCustomCentroidBondForceKernel
();
/**
/**
...
@@ -1034,16 +1024,16 @@ private:
...
@@ -1034,16 +1024,16 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
CudaArray
*
groupParticles
;
CudaArray
groupParticles
;
CudaArray
*
groupWeights
;
CudaArray
groupWeights
;
CudaArray
*
groupOffsets
;
CudaArray
groupOffsets
;
CudaArray
*
groupForces
;
CudaArray
groupForces
;
CudaArray
*
bondGroups
;
CudaArray
bondGroups
;
CudaArray
*
centerPositions
;
CudaArray
centerPositions
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
std
::
vector
<
void
*>
groupForcesArgs
;
std
::
vector
<
void
*>
groupForcesArgs
;
CUfunction
computeCentersKernel
,
groupForcesKernel
,
applyForcesKernel
;
CUfunction
computeCentersKernel
,
groupForcesKernel
,
applyForcesKernel
;
const
System
&
system
;
const
System
&
system
;
...
@@ -1055,7 +1045,7 @@ private:
...
@@ -1055,7 +1045,7 @@ private:
class
CudaCalcCustomCompoundBondForceKernel
:
public
CalcCustomCompoundBondForceKernel
{
class
CudaCalcCustomCompoundBondForceKernel
:
public
CalcCustomCompoundBondForceKernel
{
public:
public:
CudaCalcCustomCompoundBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomCompoundBondForceKernel
(
name
,
platform
),
CudaCalcCustomCompoundBondForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomCompoundBondForceKernel
(
name
,
platform
),
cu
(
cu
),
params
(
NULL
),
globals
(
NULL
),
system
(
system
)
{
cu
(
cu
),
params
(
NULL
),
system
(
system
)
{
}
}
~
CudaCalcCustomCompoundBondForceKernel
();
~
CudaCalcCustomCompoundBondForceKernel
();
/**
/**
...
@@ -1088,10 +1078,10 @@ private:
...
@@ -1088,10 +1078,10 @@ private:
CudaContext
&
cu
;
CudaContext
&
cu
;
ForceInfo
*
info
;
ForceInfo
*
info
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
globals
;
CudaArray
globals
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
const
System
&
system
;
const
System
&
system
;
};
};
...
@@ -1101,9 +1091,7 @@ private:
...
@@ -1101,9 +1091,7 @@ private:
class
CudaCalcCustomManyParticleForceKernel
:
public
CalcCustomManyParticleForceKernel
{
class
CudaCalcCustomManyParticleForceKernel
:
public
CalcCustomManyParticleForceKernel
{
public:
public:
CudaCalcCustomManyParticleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomManyParticleForceKernel
(
name
,
platform
),
CudaCalcCustomManyParticleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CudaContext
&
cu
,
const
System
&
system
)
:
CalcCustomManyParticleForceKernel
(
name
,
platform
),
hasInitializedKernel
(
false
),
cu
(
cu
),
params
(
NULL
),
particleTypes
(
NULL
),
orderIndex
(
NULL
),
particleOrder
(
NULL
),
exclusions
(
NULL
),
hasInitializedKernel
(
false
),
cu
(
cu
),
params
(
NULL
),
system
(
system
)
{
exclusionStartIndex
(
NULL
),
blockCenter
(
NULL
),
blockBoundingBox
(
NULL
),
neighborPairs
(
NULL
),
numNeighborPairs
(
NULL
),
neighborStartIndex
(
NULL
),
numNeighborsForAtom
(
NULL
),
neighbors
(
NULL
),
system
(
system
)
{
}
}
~
CudaCalcCustomManyParticleForceKernel
();
~
CudaCalcCustomManyParticleForceKernel
();
/**
/**
...
@@ -1138,21 +1126,21 @@ private:
...
@@ -1138,21 +1126,21 @@ private:
NonbondedMethod
nonbondedMethod
;
NonbondedMethod
nonbondedMethod
;
int
maxNeighborPairs
,
forceWorkgroupSize
,
findNeighborsWorkgroupSize
;
int
maxNeighborPairs
,
forceWorkgroupSize
,
findNeighborsWorkgroupSize
;
CudaParameterSet
*
params
;
CudaParameterSet
*
params
;
CudaArray
*
particleTypes
;
CudaArray
particleTypes
;
CudaArray
*
orderIndex
;
CudaArray
orderIndex
;
CudaArray
*
particleOrder
;
CudaArray
particleOrder
;
CudaArray
*
exclusions
;
CudaArray
exclusions
;
CudaArray
*
exclusionStartIndex
;
CudaArray
exclusionStartIndex
;
CudaArray
*
blockCenter
;
CudaArray
blockCenter
;
CudaArray
*
blockBoundingBox
;
CudaArray
blockBoundingBox
;
CudaArray
*
neighborPairs
;
CudaArray
neighborPairs
;
CudaArray
*
numNeighborPairs
;
CudaArray
numNeighborPairs
;
CudaArray
*
neighborStartIndex
;
CudaArray
neighborStartIndex
;
CudaArray
*
numNeighborsForAtom
;
CudaArray
numNeighborsForAtom
;
CudaArray
*
neighbors
;
CudaArray
neighbors
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
std
::
string
>
globalParamNames
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
float
>
globalParamValues
;
std
::
vector
<
CudaArray
*
>
tabulatedFunctions
;
std
::
vector
<
CudaArray
>
tabulatedFunctions
;
std
::
vector
<
void
*>
forceArgs
,
blockBoundsArgs
,
neighborsArgs
,
startIndicesArgs
,
copyPairsArgs
;
std
::
vector
<
void
*>
forceArgs
,
blockBoundsArgs
,
neighborsArgs
,
startIndicesArgs
,
copyPairsArgs
;
const
System
&
system
;
const
System
&
system
;
CUfunction
forceKernel
,
blockBoundsKernel
,
neighborsKernel
,
startIndicesKernel
,
copyPairsKernel
;
CUfunction
forceKernel
,
blockBoundsKernel
,
neighborsKernel
,
startIndicesKernel
,
copyPairsKernel
;
...
...
platforms/cuda/src/CudaBondedUtilities.cpp
View file @
f15f591b
...
@@ -84,8 +84,10 @@ void CudaBondedUtilities::initialize(const System& system) {
...
@@ -84,8 +84,10 @@ void CudaBondedUtilities::initialize(const System& system) {
for
(
int
i
=
0
;
i
<
numForces
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numForces
;
i
++
)
{
int
numBonds
=
forceAtoms
[
i
].
size
();
int
numBonds
=
forceAtoms
[
i
].
size
();
int
numAtoms
=
forceAtoms
[
i
][
0
].
size
();
int
numAtoms
=
forceAtoms
[
i
][
0
].
size
();
int
numArrays
=
(
numAtoms
+
3
)
/
4
;
int
startAtom
=
0
;
int
startAtom
=
0
;
while
(
startAtom
<
numAtoms
)
{
atomIndices
[
i
].
resize
(
numArrays
);
for
(
int
j
=
0
;
j
<
numArrays
;
j
++
)
{
int
width
=
min
(
numAtoms
-
startAtom
,
4
);
int
width
=
min
(
numAtoms
-
startAtom
,
4
);
int
paddedWidth
=
(
width
==
3
?
4
:
width
);
int
paddedWidth
=
(
width
==
3
?
4
:
width
);
vector
<
unsigned
int
>
indexVec
(
paddedWidth
*
numBonds
);
vector
<
unsigned
int
>
indexVec
(
paddedWidth
*
numBonds
);
...
@@ -93,9 +95,8 @@ void CudaBondedUtilities::initialize(const System& system) {
...
@@ -93,9 +95,8 @@ void CudaBondedUtilities::initialize(const System& system) {
for
(
int
atom
=
0
;
atom
<
width
;
atom
++
)
for
(
int
atom
=
0
;
atom
<
width
;
atom
++
)
indexVec
[
bond
*
paddedWidth
+
atom
]
=
forceAtoms
[
i
][
bond
][
startAtom
+
atom
];
indexVec
[
bond
*
paddedWidth
+
atom
]
=
forceAtoms
[
i
][
bond
][
startAtom
+
atom
];
}
}
atomIndices
[
i
].
push_back
(
CudaArray
());
atomIndices
[
i
][
j
].
initialize
(
context
,
numBonds
,
4
*
paddedWidth
,
"bondedIndices"
);
atomIndices
[
i
].
back
().
initialize
(
context
,
numBonds
,
4
*
paddedWidth
,
"bondedIndices"
);
atomIndices
[
i
][
j
].
upload
(
&
indexVec
[
0
]);
atomIndices
[
i
].
back
().
upload
(
&
indexVec
[
0
]);
startAtom
+=
width
;
startAtom
+=
width
;
}
}
}
}
...
...
platforms/cuda/src/CudaKernels.cpp
View file @
f15f591b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment