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
248522cb
Commit
248522cb
authored
Nov 16, 2008
by
Mark Friedrichs
Browse files
Mods to allow Born radii to be updated if atomic positions updated off the board
parent
5cb5d89f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
19 deletions
+26
-19
platforms/cuda/src/CudaKernels.cpp
platforms/cuda/src/CudaKernels.cpp
+1
-2
platforms/cuda/src/CudaStreamFactory.cpp
platforms/cuda/src/CudaStreamFactory.cpp
+11
-11
platforms/cuda/src/CudaStreamImpl.h
platforms/cuda/src/CudaStreamImpl.h
+14
-6
No files found.
platforms/cuda/src/CudaKernels.cpp
View file @
248522cb
...
@@ -291,6 +291,7 @@ CudaCalcGBSAOBCForceKernel::~CudaCalcGBSAOBCForceKernel() {
...
@@ -291,6 +291,7 @@ CudaCalcGBSAOBCForceKernel::~CudaCalcGBSAOBCForceKernel() {
}
}
void
CudaCalcGBSAOBCForceKernel
::
initialize
(
const
System
&
system
,
const
GBSAOBCForce
&
force
)
{
void
CudaCalcGBSAOBCForceKernel
::
initialize
(
const
System
&
system
,
const
GBSAOBCForce
&
force
)
{
int
numParticles
=
system
.
getNumParticles
();
int
numParticles
=
system
.
getNumParticles
();
_gpuContext
*
gpu
=
data
.
gpu
;
_gpuContext
*
gpu
=
data
.
gpu
;
vector
<
int
>
particle
(
numParticles
);
vector
<
int
>
particle
(
numParticles
);
...
@@ -363,8 +364,6 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa
...
@@ -363,8 +364,6 @@ static void initializeIntegration(const System& system, CudaPlatform::PlatformDa
gpuBuildExclusionList
(
gpu
);
gpuBuildExclusionList
(
gpu
);
gpuBuildOutputBuffers
(
gpu
);
gpuBuildOutputBuffers
(
gpu
);
gpuSetConstants
(
gpu
);
gpuSetConstants
(
gpu
);
kCalculateObcGbsaBornSum
(
gpu
);
kReduceObcGbsaBornSum
(
gpu
);
kClearBornForces
(
gpu
);
kClearBornForces
(
gpu
);
kClearForces
(
gpu
);
kClearForces
(
gpu
);
cudaThreadSynchronize
();
cudaThreadSynchronize
();
...
...
platforms/cuda/src/CudaStreamFactory.cpp
View file @
248522cb
...
@@ -42,39 +42,39 @@ StreamImpl* CudaStreamFactory::createStreamImpl(std::string name, int size, Stre
...
@@ -42,39 +42,39 @@ StreamImpl* CudaStreamFactory::createStreamImpl(std::string name, int size, Stre
if
(
name
==
"particlePositions"
)
{
if
(
name
==
"particlePositions"
)
{
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
float
padding
[]
=
{
100000.0
f
,
100000.0
f
,
100000.0
f
,
0.2
f
};
float
padding
[]
=
{
100000.0
f
,
100000.0
f
,
100000.0
f
,
0.2
f
};
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psPosq4
,
4
,
padding
);
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psPosq4
,
4
,
padding
,
data
.
gpu
);
}
}
if
(
name
==
"particleVelocities"
)
{
if
(
name
==
"particleVelocities"
)
{
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
float
padding
[]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
};
float
padding
[]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
};
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psVelm4
,
4
,
padding
);
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psVelm4
,
4
,
padding
,
data
.
gpu
);
}
}
if
(
name
==
"particleForces"
)
{
if
(
name
==
"particleForces"
)
{
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
CudaPlatform
::
PlatformData
&
data
=
*
static_cast
<
CudaPlatform
::
PlatformData
*>
(
context
.
getPlatformData
());
float
padding
[]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
};
float
padding
[]
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
};
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psForce4
,
4
,
padding
);
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
data
.
gpu
->
psForce4
,
4
,
padding
,
data
.
gpu
);
}
}
switch
(
type
)
{
switch
(
type
)
{
case
Stream
::
Float
:
case
Stream
::
Float
:
case
Stream
::
Double
:
case
Stream
::
Double
:
return
new
CudaStreamImpl
<
float1
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
float1
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Float2
:
case
Stream
::
Float2
:
case
Stream
::
Double2
:
case
Stream
::
Double2
:
return
new
CudaStreamImpl
<
float2
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
float2
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Float3
:
case
Stream
::
Float3
:
case
Stream
::
Double3
:
case
Stream
::
Double3
:
return
new
CudaStreamImpl
<
float3
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
float3
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Float4
:
case
Stream
::
Float4
:
case
Stream
::
Double4
:
case
Stream
::
Double4
:
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
float4
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Integer
:
case
Stream
::
Integer
:
return
new
CudaStreamImpl
<
int1
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
int1
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Integer2
:
case
Stream
::
Integer2
:
return
new
CudaStreamImpl
<
int2
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
int2
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Integer3
:
case
Stream
::
Integer3
:
return
new
CudaStreamImpl
<
int3
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
int3
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
case
Stream
::
Integer4
:
case
Stream
::
Integer4
:
return
new
CudaStreamImpl
<
int4
>
(
name
,
size
,
type
,
platform
,
1
);
return
new
CudaStreamImpl
<
int4
>
(
name
,
size
,
type
,
platform
,
1
,
NULL
);
}
}
throw
OpenMMException
(
"Tried to create a Stream with an illegal DataType."
);
throw
OpenMMException
(
"Tried to create a Stream with an illegal DataType."
);
}
}
platforms/cuda/src/CudaStreamImpl.h
View file @
248522cb
...
@@ -44,8 +44,8 @@ namespace OpenMM {
...
@@ -44,8 +44,8 @@ namespace OpenMM {
template
<
class
T
>
template
<
class
T
>
class
CudaStreamImpl
:
public
StreamImpl
{
class
CudaStreamImpl
:
public
StreamImpl
{
public:
public:
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
int
substreams
);
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
int
substreams
,
_gpuContext
*
gpu
);
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
CUDAStream
<
T
>*
stream
,
int
rowOffset
,
float
*
padding
);
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
CUDAStream
<
T
>*
stream
,
int
rowOffset
,
float
*
padding
,
_gpuContext
*
gpu
);
~
CudaStreamImpl
();
~
CudaStreamImpl
();
void
loadFromArray
(
const
void
*
array
);
void
loadFromArray
(
const
void
*
array
);
void
saveToArray
(
void
*
array
);
void
saveToArray
(
void
*
array
);
...
@@ -55,6 +55,7 @@ public:
...
@@ -55,6 +55,7 @@ public:
private:
private:
void
initType
();
void
initType
();
CUDAStream
<
T
>*
stream
;
CUDAStream
<
T
>*
stream
;
_gpuContext
*
gpu
;
bool
ownStream
;
bool
ownStream
;
int
width
,
rowOffset
;
int
width
,
rowOffset
;
float
paddingValues
[
4
];
float
paddingValues
[
4
];
...
@@ -62,15 +63,15 @@ private:
...
@@ -62,15 +63,15 @@ private:
};
};
template
<
class
T
>
template
<
class
T
>
CudaStreamImpl
<
T
>::
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
int
substreams
)
:
CudaStreamImpl
<
T
>::
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
int
substreams
,
_gpuContext
*
gpu
)
:
StreamImpl
(
name
,
size
,
type
,
platform
),
stream
(
new
CUDAStream
<
T
>
(
size
,
substreams
)),
ownStream
(
true
)
{
StreamImpl
(
name
,
size
,
type
,
platform
),
stream
(
new
CUDAStream
<
T
>
(
size
,
substreams
)),
ownStream
(
true
)
,
gpu
(
gpu
)
{
initType
();
initType
();
rowOffset
=
width
;
rowOffset
=
width
;
};
};
template
<
class
T
>
template
<
class
T
>
CudaStreamImpl
<
T
>::
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
CUDAStream
<
T
>*
stream
,
int
rowOffset
,
float
*
padding
)
:
CudaStreamImpl
<
T
>::
CudaStreamImpl
(
std
::
string
name
,
int
size
,
Stream
::
DataType
type
,
const
Platform
&
platform
,
CUDAStream
<
T
>*
stream
,
int
rowOffset
,
float
*
padding
,
_gpuContext
*
gpu
)
:
StreamImpl
(
name
,
size
,
type
,
platform
),
stream
(
stream
),
rowOffset
(
rowOffset
),
ownStream
(
false
)
{
StreamImpl
(
name
,
size
,
type
,
platform
),
stream
(
stream
),
rowOffset
(
rowOffset
),
ownStream
(
false
)
,
gpu
(
gpu
)
{
initType
();
initType
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
for
(
int
i
=
0
;
i
<
4
;
++
i
)
paddingValues
[
i
]
=
padding
[
i
];
paddingValues
[
i
]
=
padding
[
i
];
...
@@ -153,6 +154,13 @@ void CudaStreamImpl<T>::loadFromArray(const void* array) {
...
@@ -153,6 +154,13 @@ void CudaStreamImpl<T>::loadFromArray(const void* array) {
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
for
(
int
j
=
0
;
j
<
rowOffset
;
++
j
)
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
data
[
i
*
rowOffset
+
j
]
=
paddingValues
[
j
];
stream
->
Upload
();
stream
->
Upload
();
// VisualStudio compiler did not like stream == gpu->psPosq4
//if( gpu && stream == gpu->psPosq4 ){
if
(
gpu
&&
getName
()
==
"particlePositions"
){
gpu
->
bRecalculateBornRadii
=
true
;
}
}
}
template
<
class
T
>
template
<
class
T
>
...
...
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