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
cb75edd4
Commit
cb75edd4
authored
Apr 28, 2011
by
Peter Eastman
Browse files
Added pthreads library for Windows. Fixed other errors and warnings under Windows.
parent
dd352ee5
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
2291 additions
and
566 deletions
+2291
-566
CMakeLists.txt
CMakeLists.txt
+535
-522
libraries/pthreads/include/pthread.h
libraries/pthreads/include/pthread.h
+1368
-0
libraries/pthreads/include/sched.h
libraries/pthreads/include/sched.h
+178
-0
libraries/pthreads/include/semaphore.h
libraries/pthreads/include/semaphore.h
+166
-0
libraries/pthreads/lib/pthreadVC2.dll
libraries/pthreads/lib/pthreadVC2.dll
+0
-0
libraries/pthreads/lib/pthreadVC2.lib
libraries/pthreads/lib/pthreadVC2.lib
+0
-0
platforms/opencl/sharedTarget/CMakeLists.txt
platforms/opencl/sharedTarget/CMakeLists.txt
+24
-24
platforms/opencl/src/OpenCLContext.cpp
platforms/opencl/src/OpenCLContext.cpp
+2
-2
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
+1
-1
platforms/opencl/src/OpenCLKernels.cpp
platforms/opencl/src/OpenCLKernels.cpp
+9
-9
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
+1
-1
platforms/opencl/src/OpenCLParallelKernels.cpp
platforms/opencl/src/OpenCLParallelKernels.cpp
+5
-5
platforms/opencl/src/OpenCLParallelKernels.h
platforms/opencl/src/OpenCLParallelKernels.h
+1
-1
platforms/opencl/src/OpenCLSort.h
platforms/opencl/src/OpenCLSort.h
+1
-1
No files found.
CMakeLists.txt
View file @
cb75edd4
This diff is collapsed.
Click to expand it.
libraries/pthreads/include/pthread.h
0 → 100644
View file @
cb75edd4
This diff is collapsed.
Click to expand it.
libraries/pthreads/include/sched.h
0 → 100644
View file @
cb75edd4
/*
* Module: sched.h
*
* Purpose:
* Provides an implementation of POSIX realtime extensions
* as defined in
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifndef _SCHED_H
#define _SCHED_H
#undef PTW32_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
#if __GNUC__ && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the DLL code, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the DLL,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#ifndef PTW32_STATIC_LIB
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#ifndef PTW32_CONFIG_H
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#ifdef NEED_ERRNO
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif
/* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#if defined(__MINGW32__) || defined(_UWIN)
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
/* For pid_t */
# include <sys/types.h>
/* Required by Unix 98 */
# include <time.h>
#endif
/* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#else
typedef
int
pid_t
;
#endif
/* Thread scheduling policies */
enum
{
SCHED_OTHER
=
0
,
SCHED_FIFO
,
SCHED_RR
,
SCHED_MIN
=
SCHED_OTHER
,
SCHED_MAX
=
SCHED_RR
};
struct
sched_param
{
int
sched_priority
;
};
#ifdef __cplusplus
extern
"C"
{
#endif
/* __cplusplus */
PTW32_DLLPORT
int
__cdecl
sched_yield
(
void
);
PTW32_DLLPORT
int
__cdecl
sched_get_priority_min
(
int
policy
);
PTW32_DLLPORT
int
__cdecl
sched_get_priority_max
(
int
policy
);
PTW32_DLLPORT
int
__cdecl
sched_setscheduler
(
pid_t
pid
,
int
policy
);
PTW32_DLLPORT
int
__cdecl
sched_getscheduler
(
pid_t
pid
);
/*
* Note that this macro returns ENOTSUP rather than
* ENOSYS as might be expected. However, returning ENOSYS
* should mean that sched_get_priority_{min,max} are
* not implemented as well as sched_rr_get_interval.
* This is not the case, since we just don't support
* round-robin scheduling. Therefore I have chosen to
* return the same value as sched_setscheduler when
* SCHED_RR is passed to it.
*/
#define sched_rr_get_interval(_pid, _interval) \
( errno = ENOTSUP, (int) -1 )
#ifdef __cplusplus
}
/* End of extern "C" */
#endif
/* __cplusplus */
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#endif
/* !_SCHED_H */
libraries/pthreads/include/semaphore.h
0 → 100644
View file @
cb75edd4
/*
* Module: semaphore.h
*
* Purpose:
* Semaphores aren't actually part of the PThreads standard.
* They are defined by the POSIX Standard:
*
* POSIX 1003.1b-1993 (POSIX.1b)
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined( SEMAPHORE_H )
#define SEMAPHORE_H
#undef PTW32_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0
/* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2
/* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
#if __GNUC__ && ! defined (__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the DLL code, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the DLL,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#ifndef PTW32_STATIC_LIB
# ifdef PTW32_BUILD
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#ifndef PTW32_CONFIG_H
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# endif
# if defined(_UWIN) || defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
/*
*
*/
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#ifdef NEED_ERRNO
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif
/* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#define _POSIX_SEMAPHORES
#ifdef __cplusplus
extern
"C"
{
#endif
/* __cplusplus */
#ifndef HAVE_MODE_T
typedef
unsigned
int
mode_t
;
#endif
typedef
struct
sem_t_
*
sem_t
;
PTW32_DLLPORT
int
__cdecl
sem_init
(
sem_t
*
sem
,
int
pshared
,
unsigned
int
value
);
PTW32_DLLPORT
int
__cdecl
sem_destroy
(
sem_t
*
sem
);
PTW32_DLLPORT
int
__cdecl
sem_trywait
(
sem_t
*
sem
);
PTW32_DLLPORT
int
__cdecl
sem_wait
(
sem_t
*
sem
);
PTW32_DLLPORT
int
__cdecl
sem_timedwait
(
sem_t
*
sem
,
const
struct
timespec
*
abstime
);
PTW32_DLLPORT
int
__cdecl
sem_post
(
sem_t
*
sem
);
PTW32_DLLPORT
int
__cdecl
sem_post_multiple
(
sem_t
*
sem
,
int
count
);
PTW32_DLLPORT
int
__cdecl
sem_open
(
const
char
*
name
,
int
oflag
,
mode_t
mode
,
unsigned
int
value
);
PTW32_DLLPORT
int
__cdecl
sem_close
(
sem_t
*
sem
);
PTW32_DLLPORT
int
__cdecl
sem_unlink
(
const
char
*
name
);
PTW32_DLLPORT
int
__cdecl
sem_getvalue
(
sem_t
*
sem
,
int
*
sval
);
#ifdef __cplusplus
}
/* End of extern "C" */
#endif
/* __cplusplus */
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#endif
/* !SEMAPHORE_H */
libraries/pthreads/lib/pthreadVC2.dll
0 → 100644
View file @
cb75edd4
File added
libraries/pthreads/lib/pthreadVC2.lib
0 → 100644
View file @
cb75edd4
File added
platforms/opencl/sharedTarget/CMakeLists.txt
View file @
cb75edd4
#
#
# Include OpenCL related files.
# Include OpenCL related files.
#
#
# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../FindOpenCL.cmake)
# INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../FindOpenCL.cmake)
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
INCLUDE_DIRECTORIES
(
${
OPENCL_INCLUDE_DIR
}
)
FILE
(
GLOB OPENCL_KERNELS
${
CL_SOURCE_DIR
}
/kernels/*.cl
)
FILE
(
GLOB OPENCL_KERNELS
${
CL_SOURCE_DIR
}
/kernels/*.cl
)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
CL_KERNELS_CPP
}
${
CL_KERNELS_H
}
ADD_CUSTOM_COMMAND
(
OUTPUT
${
CL_KERNELS_CPP
}
${
CL_KERNELS_H
}
COMMAND
${
CMAKE_COMMAND
}
COMMAND
${
CMAKE_COMMAND
}
ARGS -D CL_SOURCE_DIR=
${
CL_SOURCE_DIR
}
-D CL_KERNELS_CPP=
${
CL_KERNELS_CPP
}
-D CL_KERNELS_H=
${
CL_KERNELS_H
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/../EncodeCLFiles.cmake
ARGS -D CL_SOURCE_DIR=
${
CL_SOURCE_DIR
}
-D CL_KERNELS_CPP=
${
CL_KERNELS_CPP
}
-D CL_KERNELS_H=
${
CL_KERNELS_H
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/../EncodeCLFiles.cmake
DEPENDS
${
OPENCL_KERNELS
}
DEPENDS
${
OPENCL_KERNELS
}
)
)
SET_SOURCE_FILES_PROPERTIES
(
${
CL_KERNELS_CPP
}
${
CL_KERNELS_H
}
PROPERTIES GENERATED TRUE
)
SET_SOURCE_FILES_PROPERTIES
(
${
CL_KERNELS_CPP
}
${
CL_KERNELS_H
}
PROPERTIES GENERATED TRUE
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
MAIN_OPENMM_LIB
${
OPENMM_LIBRARY_NAME
}
_d
)
SET
(
MAIN_OPENMM_LIB
${
OPENMM_LIBRARY_NAME
}
_d
)
ELSE
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
ELSE
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
MAIN_OPENMM_LIB
${
OPENMM_LIBRARY_NAME
}
)
SET
(
MAIN_OPENMM_LIB
${
OPENMM_LIBRARY_NAME
}
)
ENDIF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
ENDIF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
MAIN_OPENMM_LIB
}
${
OPENCL_LIBRARIES
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
MAIN_OPENMM_LIB
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY"
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"-DOPENMM_BUILDING_SHARED_LIBRARY"
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
SHARED_TARGET
}
)
INSTALL_TARGETS
(
/lib/plugins RUNTIME_DIRECTORY /lib/plugins
${
SHARED_TARGET
}
)
platforms/opencl/src/OpenCLContext.cpp
View file @
cb75edd4
...
@@ -126,10 +126,10 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex, OpenCLPlatform::
...
@@ -126,10 +126,10 @@ OpenCLContext::OpenCLContext(int numParticles, int deviceIndex, OpenCLPlatform::
cl
::
Kernel
accuracyKernel
(
utilities
,
"determineNativeAccuracy"
);
cl
::
Kernel
accuracyKernel
(
utilities
,
"determineNativeAccuracy"
);
OpenCLArray
<
mm_float8
>
values
(
*
this
,
20
,
"values"
,
true
);
OpenCLArray
<
mm_float8
>
values
(
*
this
,
20
,
"values"
,
true
);
float
nextValue
=
1e-4
;
float
nextValue
=
1e-4
f
;
for
(
int
i
=
0
;
i
<
values
.
getSize
();
++
i
)
{
for
(
int
i
=
0
;
i
<
values
.
getSize
();
++
i
)
{
values
[
i
].
s0
=
nextValue
;
values
[
i
].
s0
=
nextValue
;
nextValue
*=
M_PI
;
nextValue
*=
(
float
)
M_PI
;
}
}
values
.
upload
();
values
.
upload
();
accuracyKernel
.
setArg
<
cl
::
Buffer
>
(
0
,
values
.
getDeviceBuffer
());
accuracyKernel
.
setArg
<
cl
::
Buffer
>
(
0
,
values
.
getDeviceBuffer
());
...
...
platforms/opencl/src/OpenCLIntegrationUtilities.cpp
View file @
cb75edd4
...
@@ -466,7 +466,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
...
@@ -466,7 +466,7 @@ OpenCLIntegrationUtilities::OpenCLIntegrationUtilities(OpenCLContext& context, c
int
c
=
ccmaConstraints
[
index
];
int
c
=
ccmaConstraints
[
index
];
atomsVec
[
i
].
x
=
atom1
[
c
];
atomsVec
[
i
].
x
=
atom1
[
c
];
atomsVec
[
i
].
y
=
atom2
[
c
];
atomsVec
[
i
].
y
=
atom2
[
c
];
distanceVec
[
i
].
w
=
distance
[
c
];
distanceVec
[
i
].
w
=
(
float
)
distance
[
c
];
reducedMassVec
[
i
]
=
(
float
)
(
0.5
/
(
1.0
/
system
.
getParticleMass
(
atom1
[
c
])
+
1.0
/
system
.
getParticleMass
(
atom2
[
c
])));
reducedMassVec
[
i
]
=
(
float
)
(
0.5
/
(
1.0
/
system
.
getParticleMass
(
atom1
[
c
])
+
1.0
/
system
.
getParticleMass
(
atom2
[
c
])));
for
(
unsigned
int
j
=
0
;
j
<
matrix
[
index
].
size
();
j
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
matrix
[
index
].
size
();
j
++
)
{
constraintMatrixColumnVec
[
i
+
j
*
numCCMA
]
=
matrix
[
index
][
j
].
first
;
constraintMatrixColumnVec
[
i
+
j
*
numCCMA
]
=
matrix
[
index
][
j
].
first
;
...
...
platforms/opencl/src/OpenCLKernels.cpp
View file @
cb75edd4
...
@@ -888,10 +888,10 @@ void OpenCLCalcCMAPTorsionForceKernel::initialize(const System& system, const CM
...
@@ -888,10 +888,10 @@ void OpenCLCalcCMAPTorsionForceKernel::initialize(const System& system, const CM
mapPositionsVec
[
i
]
=
mm_int2
(
currentPosition
,
size
);
mapPositionsVec
[
i
]
=
mm_int2
(
currentPosition
,
size
);
currentPosition
+=
4
*
size
*
size
;
currentPosition
+=
4
*
size
*
size
;
for
(
int
j
=
0
;
j
<
size
*
size
;
j
++
)
{
for
(
int
j
=
0
;
j
<
size
*
size
;
j
++
)
{
coeffVec
.
push_back
(
mm_float4
(
c
[
j
][
0
],
c
[
j
][
1
],
c
[
j
][
2
],
c
[
j
][
3
]));
coeffVec
.
push_back
(
mm_float4
(
(
float
)
c
[
j
][
0
],
(
float
)
c
[
j
][
1
],
(
float
)
c
[
j
][
2
],
(
float
)
c
[
j
][
3
]));
coeffVec
.
push_back
(
mm_float4
(
c
[
j
][
4
],
c
[
j
][
5
],
c
[
j
][
6
],
c
[
j
][
7
]));
coeffVec
.
push_back
(
mm_float4
(
(
float
)
c
[
j
][
4
],
(
float
)
c
[
j
][
5
],
(
float
)
c
[
j
][
6
],
(
float
)
c
[
j
][
7
]));
coeffVec
.
push_back
(
mm_float4
(
c
[
j
][
8
],
c
[
j
][
9
],
c
[
j
][
10
],
c
[
j
][
11
]));
coeffVec
.
push_back
(
mm_float4
(
(
float
)
c
[
j
][
8
],
(
float
)
c
[
j
][
9
],
(
float
)
c
[
j
][
10
],
(
float
)
c
[
j
][
11
]));
coeffVec
.
push_back
(
mm_float4
(
c
[
j
][
12
],
c
[
j
][
13
],
c
[
j
][
14
],
c
[
j
][
15
]));
coeffVec
.
push_back
(
mm_float4
(
(
float
)
c
[
j
][
12
],
(
float
)
c
[
j
][
13
],
(
float
)
c
[
j
][
14
],
(
float
)
c
[
j
][
15
]));
}
}
}
}
vector
<
int
>
forceBufferCounter
(
system
.
getNumParticles
(),
0
);
vector
<
int
>
forceBufferCounter
(
system
.
getNumParticles
(),
0
);
...
@@ -1452,7 +1452,7 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ
...
@@ -1452,7 +1452,7 @@ double OpenCLCalcNonbondedForceKernel::execute(ContextImpl& context, bool includ
if
(
cosSinSums
!=
NULL
&&
cl
.
getContextIndex
()
==
0
)
{
if
(
cosSinSums
!=
NULL
&&
cl
.
getContextIndex
()
==
0
)
{
mm_float4
boxSize
=
cl
.
getPeriodicBoxSize
();
mm_float4
boxSize
=
cl
.
getPeriodicBoxSize
();
mm_float4
recipBoxSize
=
mm_float4
((
float
)
(
2
*
M_PI
/
boxSize
.
x
),
(
float
)
(
2
*
M_PI
/
boxSize
.
y
),
(
float
)
(
2
*
M_PI
/
boxSize
.
z
),
0
);
mm_float4
recipBoxSize
=
mm_float4
((
float
)
(
2
*
M_PI
/
boxSize
.
x
),
(
float
)
(
2
*
M_PI
/
boxSize
.
y
),
(
float
)
(
2
*
M_PI
/
boxSize
.
z
),
0
);
float
recipCoefficient
=
ONE_4PI_EPS0
*
4
*
M_PI
/
(
boxSize
.
x
*
boxSize
.
y
*
boxSize
.
z
);
float
recipCoefficient
=
(
float
)
(
ONE_4PI_EPS0
*
4
*
M_PI
/
(
boxSize
.
x
*
boxSize
.
y
*
boxSize
.
z
)
)
;
ewaldSumsKernel
.
setArg
<
mm_float4
>
(
3
,
recipBoxSize
);
ewaldSumsKernel
.
setArg
<
mm_float4
>
(
3
,
recipBoxSize
);
ewaldSumsKernel
.
setArg
<
cl_float
>
(
4
,
recipCoefficient
);
ewaldSumsKernel
.
setArg
<
cl_float
>
(
4
,
recipCoefficient
);
cl
.
executeKernel
(
ewaldSumsKernel
,
cosSinSums
->
getSize
());
cl
.
executeKernel
(
ewaldSumsKernel
,
cosSinSums
->
getSize
());
...
@@ -1581,7 +1581,7 @@ void OpenCLCalcCustomNonbondedForceKernel::initialize(const System& system, cons
...
@@ -1581,7 +1581,7 @@ void OpenCLCalcCustomNonbondedForceKernel::initialize(const System& system, cons
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functions
[
name
]
=
&
fp
;
functions
[
name
]
=
&
fp
;
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
values
.
size
()
-
2
);
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
(
float
)
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
@@ -1932,7 +1932,7 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
...
@@ -1932,7 +1932,7 @@ void OpenCLCalcCustomGBForceKernel::initialize(const System& system, const Custo
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
string
arrayName
=
prefix
+
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functions
[
name
]
=
&
fp
;
functions
[
name
]
=
&
fp
;
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
values
.
size
()
-
2
);
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
(
float
)
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
@@ -3003,7 +3003,7 @@ void OpenCLCalcCustomHbondForceKernel::initialize(const System& system, const Cu
...
@@ -3003,7 +3003,7 @@ void OpenCLCalcCustomHbondForceKernel::initialize(const System& system, const Cu
string
arrayName
=
"table"
+
intToString
(
i
);
string
arrayName
=
"table"
+
intToString
(
i
);
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functionDefinitions
.
push_back
(
make_pair
(
name
,
arrayName
));
functions
[
name
]
=
&
fp
;
functions
[
name
]
=
&
fp
;
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
values
.
size
()
-
2
);
tabulatedFunctionParamsVec
[
i
]
=
mm_float4
((
float
)
min
,
(
float
)
max
,
(
float
)
((
values
.
size
()
-
1
)
/
(
max
-
min
)),
(
float
)
values
.
size
()
-
2
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
vector
<
mm_float4
>
f
=
OpenCLExpressionUtilities
::
computeFunctionCoefficients
(
values
,
min
,
max
);
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
.
push_back
(
new
OpenCLArray
<
mm_float4
>
(
cl
,
values
.
size
()
-
1
,
"TabulatedFunction"
));
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
tabulatedFunctions
[
tabulatedFunctions
.
size
()
-
1
]
->
upload
(
f
);
...
@@ -3387,7 +3387,7 @@ void OpenCLIntegrateLangevinStepKernel::execute(ContextImpl& context, const Lang
...
@@ -3387,7 +3387,7 @@ void OpenCLIntegrateLangevinStepKernel::execute(ContextImpl& context, const Lang
p
[
1
]
=
(
cl_float
)
fscale
;
p
[
1
]
=
(
cl_float
)
fscale
;
p
[
2
]
=
(
cl_float
)
noisescale
;
p
[
2
]
=
(
cl_float
)
noisescale
;
params
->
upload
(
p
);
params
->
upload
(
p
);
integration
.
getStepSize
()[
0
].
y
=
stepSize
;
integration
.
getStepSize
()[
0
].
y
=
(
cl_float
)
stepSize
;
integration
.
getStepSize
().
upload
();
integration
.
getStepSize
().
upload
();
prevTemp
=
temperature
;
prevTemp
=
temperature
;
prevFriction
=
friction
;
prevFriction
=
friction
;
...
...
platforms/opencl/src/OpenCLNonbondedUtilities.cpp
View file @
cb75edd4
...
@@ -313,7 +313,7 @@ void OpenCLNonbondedUtilities::updateNeighborListSize() {
...
@@ -313,7 +313,7 @@ void OpenCLNonbondedUtilities::updateNeighborListSize() {
if
(
!
useCutoff
)
if
(
!
useCutoff
)
return
;
return
;
interactionCount
->
download
();
interactionCount
->
download
();
if
(
interactionCount
->
get
(
0
)
<=
interactingTiles
->
getSize
())
if
(
interactionCount
->
get
(
0
)
<=
(
unsigned
int
)
interactingTiles
->
getSize
())
return
;
return
;
// The most recent timestep had too many interactions to fit in the arrays. Make the arrays bigger to prevent
// The most recent timestep had too many interactions to fit in the arrays. Make the arrays bigger to prevent
...
...
platforms/opencl/src/OpenCLParallelKernels.cpp
View file @
cb75edd4
...
@@ -34,17 +34,17 @@ using namespace std;
...
@@ -34,17 +34,17 @@ using namespace std;
*/
*/
#ifdef _MSC_VER
#ifdef _MSC_VER
#include <Windows.h>
#include <Windows.h>
static
long
getTime
()
{
static
long
long
getTime
()
{
FILETIME
ft
;
FILETIME
ft
;
GetSystemTimeAsFileTime
(
&
ft
);
// 100-nanoseconds since 1-1-1601
GetSystemTimeAsFileTime
(
&
ft
);
// 100-nanoseconds since 1-1-1601
ULARGE_INTEGER
result
;
ULARGE_INTEGER
result
;
result
.
LowPart
=
ft
.
dwLowDateTime
;
result
.
LowPart
=
ft
.
dwLowDateTime
;
result
.
HighPart
=
ft
.
dwHighDateTime
;
result
.
HighPart
=
ft
.
dwHighDateTime
;
return
result
/
10
;
return
result
.
QuadPart
/
10
;
}
}
#else
#else
#include <sys/time.h>
#include <sys/time.h>
static
long
getTime
()
{
static
long
long
getTime
()
{
struct
timeval
tod
;
struct
timeval
tod
;
gettimeofday
(
&
tod
,
0
);
gettimeofday
(
&
tod
,
0
);
return
1000000
*
tod
.
tv_sec
+
tod
.
tv_usec
;
return
1000000
*
tod
.
tv_sec
+
tod
.
tv_usec
;
...
@@ -74,7 +74,7 @@ private:
...
@@ -74,7 +74,7 @@ private:
class
OpenCLParallelCalcForcesAndEnergyKernel
::
FinishComputationTask
:
public
OpenCLContext
::
WorkTask
{
class
OpenCLParallelCalcForcesAndEnergyKernel
::
FinishComputationTask
:
public
OpenCLContext
::
WorkTask
{
public:
public:
FinishComputationTask
(
ContextImpl
&
context
,
OpenCLContext
&
cl
,
OpenCLCalcForcesAndEnergyKernel
&
kernel
,
FinishComputationTask
(
ContextImpl
&
context
,
OpenCLContext
&
cl
,
OpenCLCalcForcesAndEnergyKernel
&
kernel
,
bool
includeForce
,
bool
includeEnergy
,
double
&
energy
,
long
&
completionTime
)
:
context
(
context
),
cl
(
cl
),
kernel
(
kernel
),
bool
includeForce
,
bool
includeEnergy
,
double
&
energy
,
long
long
&
completionTime
)
:
context
(
context
),
cl
(
cl
),
kernel
(
kernel
),
includeForce
(
includeForce
),
includeEnergy
(
includeEnergy
),
energy
(
energy
),
completionTime
(
completionTime
)
{
includeForce
(
includeForce
),
includeEnergy
(
includeEnergy
),
energy
(
energy
),
completionTime
(
completionTime
)
{
}
}
void
execute
()
{
void
execute
()
{
...
@@ -91,7 +91,7 @@ private:
...
@@ -91,7 +91,7 @@ private:
OpenCLCalcForcesAndEnergyKernel
&
kernel
;
OpenCLCalcForcesAndEnergyKernel
&
kernel
;
bool
includeForce
,
includeEnergy
;
bool
includeForce
,
includeEnergy
;
double
&
energy
;
double
&
energy
;
long
&
completionTime
;
long
long
&
completionTime
;
};
};
OpenCLParallelCalcForcesAndEnergyKernel
::
OpenCLParallelCalcForcesAndEnergyKernel
(
string
name
,
const
Platform
&
platform
,
OpenCLPlatform
::
PlatformData
&
data
)
:
OpenCLParallelCalcForcesAndEnergyKernel
::
OpenCLParallelCalcForcesAndEnergyKernel
(
string
name
,
const
Platform
&
platform
,
OpenCLPlatform
::
PlatformData
&
data
)
:
...
...
platforms/opencl/src/OpenCLParallelKernels.h
View file @
cb75edd4
...
@@ -76,7 +76,7 @@ private:
...
@@ -76,7 +76,7 @@ private:
class
FinishComputationTask
;
class
FinishComputationTask
;
OpenCLPlatform
::
PlatformData
&
data
;
OpenCLPlatform
::
PlatformData
&
data
;
std
::
vector
<
Kernel
>
kernels
;
std
::
vector
<
Kernel
>
kernels
;
std
::
vector
<
long
>
completionTimes
;
std
::
vector
<
long
long
>
completionTimes
;
std
::
vector
<
int
>
contextTiles
;
std
::
vector
<
int
>
contextTiles
;
};
};
...
...
platforms/opencl/src/OpenCLSort.h
View file @
cb75edd4
...
@@ -87,7 +87,7 @@ public:
...
@@ -87,7 +87,7 @@ public:
sortKernelSize
=
rangeKernelSize
/
2
;
sortKernelSize
=
rangeKernelSize
/
2
;
if
(
rangeKernelSize
>
length
)
if
(
rangeKernelSize
>
length
)
rangeKernelSize
=
length
;
rangeKernelSize
=
length
;
int
maxLocalBuffer
=
(
context
.
getDevice
().
getInfo
<
CL_DEVICE_LOCAL_MEM_SIZE
>
()
/
sizeof
(
TYPE
))
/
2
;
int
maxLocalBuffer
=
(
int
)
(
(
context
.
getDevice
().
getInfo
<
CL_DEVICE_LOCAL_MEM_SIZE
>
()
/
sizeof
(
TYPE
))
/
2
)
;
if
(
sortKernelSize
>
maxLocalBuffer
)
if
(
sortKernelSize
>
maxLocalBuffer
)
sortKernelSize
=
maxLocalBuffer
;
sortKernelSize
=
maxLocalBuffer
;
int
targetBucketSize
=
sortKernelSize
/
2
;
int
targetBucketSize
=
sortKernelSize
/
2
;
...
...
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