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
bed943bd
Commit
bed943bd
authored
Dec 09, 2009
by
Peter Eastman
Browse files
Increased the allowed size of custom expressions. Also fixed one failing test case.
parent
7eec4930
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
29 deletions
+31
-29
platforms/cuda/src/kernels/cudaKernels.h
platforms/cuda/src/kernels/cudaKernels.h
+6
-6
platforms/cuda/src/kernels/gpu.cpp
platforms/cuda/src/kernels/gpu.cpp
+11
-9
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
+4
-4
platforms/cuda/src/kernels/kCalculateCustomExternalForces.cu
platforms/cuda/src/kernels/kCalculateCustomExternalForces.cu
+6
-6
platforms/cuda/src/kernels/kCalculateCustomNonbondedForces.cu
...forms/cuda/src/kernels/kCalculateCustomNonbondedForces.cu
+4
-4
No files found.
platforms/cuda/src/kernels/cudaKernels.h
View file @
bed943bd
...
@@ -111,12 +111,12 @@ extern void SetBrownianUpdateSim(gpuContext gpu);
...
@@ -111,12 +111,12 @@ extern void SetBrownianUpdateSim(gpuContext gpu);
extern
void
GetBrownianUpdateSim
(
gpuContext
gpu
);
extern
void
GetBrownianUpdateSim
(
gpuContext
gpu
);
extern
void
SetRandomSim
(
gpuContext
gpu
);
extern
void
SetRandomSim
(
gpuContext
gpu
);
extern
void
GetRandomSim
(
gpuContext
gpu
);
extern
void
GetRandomSim
(
gpuContext
gpu
);
extern
void
SetCustomBondForceExpression
(
const
Expression
<
128
>&
expression
);
extern
void
SetCustomBondForceExpression
(
const
Expression
<
256
>&
expression
);
extern
void
SetCustomBondEnergyExpression
(
const
Expression
<
128
>&
expression
);
extern
void
SetCustomBondEnergyExpression
(
const
Expression
<
256
>&
expression
);
extern
void
SetCustomBondGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
extern
void
SetCustomBondGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
extern
void
SetCustomExternalForceExpressions
(
const
Expression
<
128
>&
expressionX
,
const
Expression
<
128
>&
expressionY
,
const
Expression
<
128
>&
expressionZ
);
extern
void
SetCustomExternalForceExpressions
(
const
Expression
<
256
>&
expressionX
,
const
Expression
<
256
>&
expressionY
,
const
Expression
<
256
>&
expressionZ
);
extern
void
SetCustomExternalEnergyExpression
(
const
Expression
<
128
>&
expression
);
extern
void
SetCustomExternalEnergyExpression
(
const
Expression
<
256
>&
expression
);
extern
void
SetCustomExternalGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
extern
void
SetCustomExternalGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
extern
void
SetCustomNonbondedForceExpression
(
const
Expression
<
128
>&
expression
);
extern
void
SetCustomNonbondedForceExpression
(
const
Expression
<
256
>&
expression
);
extern
void
SetCustomNonbondedEnergyExpression
(
const
Expression
<
128
>&
expression
);
extern
void
SetCustomNonbondedEnergyExpression
(
const
Expression
<
256
>&
expression
);
extern
void
SetCustomNonbondedGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
extern
void
SetCustomNonbondedGlobalParams
(
const
std
::
vector
<
float
>&
paramValues
);
platforms/cuda/src/kernels/gpu.cpp
View file @
bed943bd
...
@@ -691,8 +691,8 @@ void gpuSetCustomBondParameters(gpuContext gpu, const vector<int>& bondAtom1, co
...
@@ -691,8 +691,8 @@ void gpuSetCustomBondParameters(gpuContext gpu, const vector<int>& bondAtom1, co
variables
.
push_back
(
"r"
);
variables
.
push_back
(
"r"
);
for
(
int
i
=
0
;
i
<
(
int
)
paramNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
paramNames
.
size
();
i
++
)
variables
.
push_back
(
paramNames
[
i
]);
variables
.
push_back
(
paramNames
[
i
]);
SetCustomBondEnergyExpression
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomBondEnergyExpression
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomBondForceExpression
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"r"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomBondForceExpression
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"r"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
}
}
extern
"C"
extern
"C"
...
@@ -733,10 +733,10 @@ void gpuSetCustomExternalParameters(gpuContext gpu, const vector<int>& atomIndex
...
@@ -733,10 +733,10 @@ void gpuSetCustomExternalParameters(gpuContext gpu, const vector<int>& atomIndex
variables
.
push_back
(
"z"
);
variables
.
push_back
(
"z"
);
for
(
int
i
=
0
;
i
<
(
int
)
paramNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
paramNames
.
size
();
i
++
)
variables
.
push_back
(
paramNames
[
i
]);
variables
.
push_back
(
paramNames
[
i
]);
SetCustomExternalEnergyExpression
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomExternalEnergyExpression
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomExternalForceExpressions
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"x"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
),
SetCustomExternalForceExpressions
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"x"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
),
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"y"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
),
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"y"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
),
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"z"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
).
differentiate
(
"z"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
}
}
extern
"C"
extern
"C"
...
@@ -815,8 +815,8 @@ void gpuSetCustomNonbondedParameters(gpuContext gpu, const vector<vector<double>
...
@@ -815,8 +815,8 @@ void gpuSetCustomNonbondedParameters(gpuContext gpu, const vector<vector<double>
variables
.
push_back
(
""
);
variables
.
push_back
(
""
);
}
}
variables
.
push_back
(
"r"
);
variables
.
push_back
(
"r"
);
SetCustomNonbondedEnergyExpression
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
,
functions
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomNonbondedEnergyExpression
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
,
functions
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomNonbondedForceExpression
(
createExpression
<
128
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
,
functions
).
differentiate
(
"r"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
SetCustomNonbondedForceExpression
(
createExpression
<
256
>
(
gpu
,
energyExp
,
Lepton
::
Parser
::
parse
(
energyExp
,
functions
).
differentiate
(
"r"
).
optimize
().
createProgram
(),
variables
,
globalParamNames
,
gpu
->
sim
.
customExpressionStackSize
));
delete
fp
;
delete
fp
;
}
}
...
@@ -1843,6 +1843,7 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
...
@@ -1843,6 +1843,7 @@ void* gpuInit(int numAtoms, unsigned int device, bool useBlockingSync)
gpu
->
psShakeParameter
=
NULL
;
gpu
->
psShakeParameter
=
NULL
;
gpu
->
psSettleID
=
NULL
;
gpu
->
psSettleID
=
NULL
;
gpu
->
psSettleParameter
=
NULL
;
gpu
->
psSettleParameter
=
NULL
;
gpu
->
psNonShakeID
=
NULL
;
gpu
->
psExclusion
=
NULL
;
gpu
->
psExclusion
=
NULL
;
gpu
->
psExclusionIndex
=
NULL
;
gpu
->
psExclusionIndex
=
NULL
;
gpu
->
psWorkUnit
=
NULL
;
gpu
->
psWorkUnit
=
NULL
;
...
@@ -2044,7 +2045,8 @@ void gpuShutDown(gpuContext gpu)
...
@@ -2044,7 +2045,8 @@ void gpuShutDown(gpuContext gpu)
delete
gpu
->
psShakeParameter
;
delete
gpu
->
psShakeParameter
;
delete
gpu
->
psSettleID
;
delete
gpu
->
psSettleID
;
delete
gpu
->
psSettleParameter
;
delete
gpu
->
psSettleParameter
;
delete
gpu
->
psNonShakeID
;
if
(
gpu
->
psNonShakeID
!=
NULL
)
delete
gpu
->
psNonShakeID
;
delete
gpu
->
psExclusion
;
delete
gpu
->
psExclusion
;
delete
gpu
->
psExclusionIndex
;
delete
gpu
->
psExclusionIndex
;
delete
gpu
->
psWorkUnit
;
delete
gpu
->
psWorkUnit
;
...
...
platforms/cuda/src/kernels/kCalculateCustomBondForces.cu
View file @
bed943bd
...
@@ -37,8 +37,8 @@ using namespace std;
...
@@ -37,8 +37,8 @@ using namespace std;
#include "cudatypes.h"
#include "cudatypes.h"
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
Expression
<
128
>
forceExp
;
static
__constant__
Expression
<
256
>
forceExp
;
static
__constant__
Expression
<
128
>
energyExp
;
static
__constant__
Expression
<
256
>
energyExp
;
#include "kEvaluateExpression.h"
#include "kEvaluateExpression.h"
...
@@ -56,14 +56,14 @@ void GetCalculateCustomBondForcesSim(gpuContext gpu)
...
@@ -56,14 +56,14 @@ void GetCalculateCustomBondForcesSim(gpuContext gpu)
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
}
}
void
SetCustomBondForceExpression
(
const
Expression
<
128
>&
expression
)
void
SetCustomBondForceExpression
(
const
Expression
<
256
>&
expression
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
forceExp
,
&
expression
,
sizeof
(
forceExp
));
status
=
cudaMemcpyToSymbol
(
forceExp
,
&
expression
,
sizeof
(
forceExp
));
RTERROR
(
status
,
"SetCustomBondForceExpression: cudaMemcpyToSymbol failed"
);
RTERROR
(
status
,
"SetCustomBondForceExpression: cudaMemcpyToSymbol failed"
);
}
}
void
SetCustomBondEnergyExpression
(
const
Expression
<
128
>&
expression
)
void
SetCustomBondEnergyExpression
(
const
Expression
<
256
>&
expression
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
...
...
platforms/cuda/src/kernels/kCalculateCustomExternalForces.cu
View file @
bed943bd
...
@@ -37,10 +37,10 @@ using namespace std;
...
@@ -37,10 +37,10 @@ using namespace std;
#include "cudatypes.h"
#include "cudatypes.h"
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
Expression
<
128
>
forceExpX
;
static
__constant__
Expression
<
256
>
forceExpX
;
static
__constant__
Expression
<
128
>
forceExpY
;
static
__constant__
Expression
<
256
>
forceExpY
;
static
__constant__
Expression
<
128
>
forceExpZ
;
static
__constant__
Expression
<
256
>
forceExpZ
;
static
__constant__
Expression
<
128
>
energyExp
;
static
__constant__
Expression
<
256
>
energyExp
;
#include "kEvaluateExpression.h"
#include "kEvaluateExpression.h"
...
@@ -58,7 +58,7 @@ void GetCalculateCustomExternalForcesSim(gpuContext gpu)
...
@@ -58,7 +58,7 @@ void GetCalculateCustomExternalForcesSim(gpuContext gpu)
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
}
}
void
SetCustomExternalForceExpressions
(
const
Expression
<
128
>&
expressionX
,
const
Expression
<
128
>&
expressionY
,
const
Expression
<
128
>&
expressionZ
)
void
SetCustomExternalForceExpressions
(
const
Expression
<
256
>&
expressionX
,
const
Expression
<
256
>&
expressionY
,
const
Expression
<
256
>&
expressionZ
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
forceExpX
,
&
expressionX
,
sizeof
(
forceExpX
));
status
=
cudaMemcpyToSymbol
(
forceExpX
,
&
expressionX
,
sizeof
(
forceExpX
));
...
@@ -67,7 +67,7 @@ void SetCustomExternalForceExpressions(const Expression<128>& expressionX, const
...
@@ -67,7 +67,7 @@ void SetCustomExternalForceExpressions(const Expression<128>& expressionX, const
RTERROR
(
status
,
"SetCustomExternalForceExpression: cudaMemcpyToSymbol failed"
);
RTERROR
(
status
,
"SetCustomExternalForceExpression: cudaMemcpyToSymbol failed"
);
}
}
void
SetCustomExternalEnergyExpression
(
const
Expression
<
128
>&
expression
)
void
SetCustomExternalEnergyExpression
(
const
Expression
<
256
>&
expression
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
...
...
platforms/cuda/src/kernels/kCalculateCustomNonbondedForces.cu
View file @
bed943bd
...
@@ -50,8 +50,8 @@ struct Atom {
...
@@ -50,8 +50,8 @@ struct Atom {
};
};
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
Expression
<
128
>
forceExp
;
static
__constant__
Expression
<
256
>
forceExp
;
static
__constant__
Expression
<
128
>
energyExp
;
static
__constant__
Expression
<
256
>
energyExp
;
#include "kEvaluateExpression.h"
#include "kEvaluateExpression.h"
...
@@ -69,14 +69,14 @@ void GetCalculateCustomNonbondedForcesSim(gpuContext gpu)
...
@@ -69,14 +69,14 @@ void GetCalculateCustomNonbondedForcesSim(gpuContext gpu)
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
RTERROR
(
status
,
"cudaMemcpyFromSymbol: SetSim copy from cSim failed"
);
}
}
void
SetCustomNonbondedForceExpression
(
const
Expression
<
128
>&
expression
)
void
SetCustomNonbondedForceExpression
(
const
Expression
<
256
>&
expression
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
forceExp
,
&
expression
,
sizeof
(
forceExp
));
status
=
cudaMemcpyToSymbol
(
forceExp
,
&
expression
,
sizeof
(
forceExp
));
RTERROR
(
status
,
"SetCustomNonbondedForceExpression: cudaMemcpyToSymbol failed"
);
RTERROR
(
status
,
"SetCustomNonbondedForceExpression: cudaMemcpyToSymbol failed"
);
}
}
void
SetCustomNonbondedEnergyExpression
(
const
Expression
<
128
>&
expression
)
void
SetCustomNonbondedEnergyExpression
(
const
Expression
<
256
>&
expression
)
{
{
cudaError_t
status
;
cudaError_t
status
;
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
status
=
cudaMemcpyToSymbol
(
energyExp
,
&
expression
,
sizeof
(
energyExp
));
...
...
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