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
32d3f86d
"devtools/packaging/scripts/vscode:/vscode.git/clone" did not exist on "c739aaffaf286d10f4b989b5425d428cf99687f2"
Commit
32d3f86d
authored
Sep 10, 2012
by
Peter Eastman
Browse files
Release the Python global interpreter lock during expensive operations
parent
813e8ef6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
wrappers/python/src/swig_doxygen/swig_lib/python/exceptions.i
...pers/python/src/swig_doxygen/swig_lib/python/exceptions.i
+20
-0
wrappers/python/src/swig_doxygen/swig_lib/python/extend.i
wrappers/python/src/swig_doxygen/swig_lib/python/extend.i
+8
-2
No files found.
wrappers/python/src/swig_doxygen/swig_lib/python/exceptions.i
View file @
32d3f86d
...
...
@@ -8,4 +8,24 @@
}
}
%
exception
*::
step
{
try
{
Py_BEGIN_ALLOW_THREADS
$
action
Py_END_ALLOW_THREADS
}
catch
(
std
::
exception
&
e)
{
PyErr_SetString
(
PyExc_Exception
,
const_cast
<
char
*>
(
e
.
what
()))
;
return
NULL
;
}
}
%
exception
OpenMM
::
LocalEnergyMinimizer
::
minimize
{
try
{
Py_BEGIN_ALLOW_THREADS
$
action
Py_END_ALLOW_THREADS
}
catch
(
std
::
exception
&
e)
{
PyErr_SetString
(
PyExc_Exception
,
const_cast
<
char
*>
(
e
.
what
()))
;
return
NULL
;
}
}
wrappers/python/src/swig_doxygen/swig_lib/python/extend.i
View file @
32d3f86d
...
...
@@ -6,13 +6,16 @@
int
getParameters
,
int
enforcePeriodic
,
int
groups
)
{
State
state
;
Py_BEGIN_ALLOW_THREADS
int
types
=
0
;
if
(
getPositions
)
types
|=
State
::
Positions
;
if
(
getVelocities
)
types
|=
State
::
Velocities
;
if
(
getForces
)
types
|=
State
::
Forces
;
if
(
getEnergy
)
types
|=
State
::
Energy
;
if
(
getParameters
)
types
|=
State
::
Parameters
;
State
state
=
self-
>
getState
(
types
,
enforcePeriodic
,
groups
)
;
state
=
self-
>
getState
(
types
,
enforcePeriodic
,
groups
)
;
Py_END_ALLOW_THREADS
return
_convertStateToLists
(
state
)
;
}
...
...
@@ -122,13 +125,16 @@ Parameters:
int
getParameters
,
int
enforcePeriodic
,
int
groups
)
{
State
state
;
Py_BEGIN_ALLOW_THREADS
int
types
=
0
;
if
(
getPositions
)
types
|=
State
::
Positions
;
if
(
getVelocities
)
types
|=
State
::
Velocities
;
if
(
getForces
)
types
|=
State
::
Forces
;
if
(
getEnergy
)
types
|=
State
::
Energy
;
if
(
getParameters
)
types
|=
State
::
Parameters
;
State
state
=
self-
>
getState
(
copy
,
types
,
enforcePeriodic
,
groups
)
;
state
=
self-
>
getState
(
copy
,
types
,
enforcePeriodic
,
groups
)
;
Py_END_ALLOW_THREADS
return
_convertStateToLists
(
state
)
;
}
...
...
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