Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit threads usage in numpy during test to avoid time-out #4584

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
17 changes: 9 additions & 8 deletions testsuite/MDAnalysisTests/analysis/test_encore.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ def test_triangular_matrix(self):
reason="Not yet supported on Windows.")
def test_parallel_calculation(self):

arguments = [tuple([i]) for i in np.arange(0,100)]
arguments = [tuple([i]) for i in np.arange(0,10)]

parallel_calculation = encore.utils.ParallelCalculation(function=function,
n_jobs=4,
n_jobs=2,
orbeckst marked this conversation as resolved.
Show resolved Hide resolved
args=arguments)
results = parallel_calculation.run()

Expand All @@ -142,12 +142,12 @@ def test_rmsd_matrix_with_superimposition(self, ens1):
conf_dist_matrix = encore.confdistmatrix.conformational_distance_matrix(
ens1,
encore.confdistmatrix.set_rmsd_matrix_elements,
select="name CA",
select="name CA and resnum 1:3",
orbeckst marked this conversation as resolved.
Show resolved Hide resolved
pairwise_align=True,
weights='mass',
n_jobs=1)

reference = rms.RMSD(ens1, select="name CA")
reference = rms.RMSD(ens1, select="name CA and resnum 1:3")
reference.run()
err_msg = (
"Calculated RMSD values differ from "
Expand All @@ -159,24 +159,25 @@ def test_rmsd_matrix_with_superimposition_custom_weights(self, ens1):
conf_dist_matrix = encore.confdistmatrix.conformational_distance_matrix(
ens1,
encore.confdistmatrix.set_rmsd_matrix_elements,
select="name CA",
select="name CA and resnum 1:3",
pairwise_align=True,
weights='mass',
n_jobs=1)

conf_dist_matrix_custom = encore.confdistmatrix.conformational_distance_matrix(
ens1,
encore.confdistmatrix.set_rmsd_matrix_elements,
select="name CA",
select="name CA and resnum 1:3",
pairwise_align=True,
weights=(ens1.select_atoms('name CA').masses, ens1.select_atoms('name CA').masses),
weights=(ens1.select_atoms("name CA and resnum 1:3").masses,
ens1.select_atoms("name CA and resnum 1:3").masses),
n_jobs=1)

for i in range(conf_dist_matrix_custom.size):
assert_allclose(conf_dist_matrix_custom[0, i], conf_dist_matrix[0, i], rtol=0, atol=1.5e-7)

def test_rmsd_matrix_without_superimposition(self, ens1):
selection_string = "name CA"
selection_string = "name CA and resnum 1:3"
selection = ens1.select_atoms(selection_string)
reference_rmsd = []
coordinates = ens1.trajectory.timeseries(selection, order='fac')
Expand Down
14 changes: 7 additions & 7 deletions testsuite/MDAnalysisTests/parallelism/test_multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
),
(NCDF,),
(np.arange(150).reshape(5, 10, 3).astype(np.float64),),
(GRO, [GRO, GRO, GRO, GRO, GRO]),
(PDB, [PDB, PDB, PDB, PDB, PDB]),
(GRO, [GRO, GRO]),
(PDB, [PDB, PDB]),
(GRO, [XTC, XTC]),
(TRC_PDB_VAC, TRC_TRAJ1_VAC),
(TRC_PDB_VAC, [TRC_TRAJ1_VAC, TRC_TRAJ2_VAC]),
Expand Down Expand Up @@ -121,11 +121,11 @@ def test_multiprocess_COG(u):
ag = u.atoms[2:5]

ref = np.array([cog(u, ag, i)
for i in range(3)])
for i in range(2)])

p = multiprocessing.Pool(2)
res = np.array([p.apply(cog, args=(u, ag, i))
for i in range(3)])
for i in range(2)])
p.close()
assert_equal(ref, res)

Expand Down Expand Up @@ -198,9 +198,9 @@ def test_creating_multiple_universe_without_offset(temp_xtc, ncopies=3):
('memory', np.arange(60).reshape(2, 10, 3).astype(np.float64), dict()),
('TRC', TRC_TRAJ1_VAC, dict()),
('CHAIN', [TRC_TRAJ1_VAC, TRC_TRAJ2_VAC], dict()),
('CHAIN', [GRO, GRO, GRO], dict()),
('CHAIN', [PDB, PDB, PDB], dict()),
('CHAIN', [XTC, XTC, XTC], dict()),
('CHAIN', [GRO, GRO], dict()),
('CHAIN', [PDB, PDB], dict()),
('CHAIN', [XTC, XTC], dict()),
])
def ref_reader(request):
fmt_name, filename, extras = request.param
Expand Down
Loading