12
12
import unittest
13
13
import warnings
14
14
15
- # this set of tests ensures that we achieve >= 90% parallel performance
16
- # compared to perfect scaling of single-threaded jobs to multiple cores
17
- PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING = 0.90
15
+ # this set of tests ensures that we achieve >= 75% parallel performance compared to perfect scaling of
16
+ # single-threaded jobs to multiple cores (with no memory contention). This threshold will be decreased in
17
+ # determine_target_parallelization_speedup() if the background CPU utilization exceeds 20%.
18
+ PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING = 0.75
18
19
19
20
20
21
def mock_calculation (_ ):
@@ -39,7 +40,7 @@ def determine_target_parallelization_speedup(num_calculations=32):
39
40
40
41
sleep (5 ) # sleep to increase stability of the CPU utilization check
41
42
cpu_utilization = psutil .cpu_percent ()
42
- if cpu_utilization > 10 :
43
+ if cpu_utilization > 20 :
43
44
PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING = 0.5
44
45
warnings .warn (f"System CPU utilization is non-negligible during parallel performance test! "
45
46
f"Dropping performance scaling target to 50%." )
@@ -103,9 +104,9 @@ def test_tiny_singlelayer_graph_many_runs(self):
103
104
self .assertGreater (parallelization , PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING )
104
105
105
106
def test_larger_singlelayer_graph_few_runs (self ):
106
- """Single-threaded equivalent is 25 runs on G(n=10000, m=40000)."""
107
+ """Single-threaded equivalent is 50 runs on G(n=10000, m=40000)."""
107
108
G = generate_connected_ER (n = 10000 , m = 40000 , directed = False )
108
- gammas = np .linspace (0.0 , 2.0 , 25 )
109
+ gammas = np .linspace (0.0 , 2.0 , 50 )
109
110
parallelization = self .run_singlelayer_graph_parallelization (G , gammas )
110
111
self .assertGreater (parallelization , PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING )
111
112
@@ -125,16 +126,16 @@ def test_tiny_multilayer_graph_many_runs(self):
125
126
self .assertGreater (parallelization , PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING )
126
127
127
128
def test_larger_multilayer_graph_few_runs (self ):
128
- """Single-threaded equivalent is 25 runs on approximately G(n=2500, m=15000)."""
129
+ """Single-threaded equivalent is 49 runs on approximately G(n=2500, m=15000)."""
129
130
G_intralayer , layer_membership = generate_multilayer_intralayer_SBM (
130
131
copying_probability = 0.9 , p_in = 0.15 , p_out = 0.05 , first_layer_membership = [0 ] * 50 + [1 ] * 50 , num_layers = 25
131
132
)
132
133
interlayer_edges = [(100 * layer + v , 100 * layer + v + 100 )
133
134
for layer in range (25 - 1 ) for v in range (100 )]
134
135
G_interlayer = ig .Graph (interlayer_edges , directed = True )
135
136
136
- gammas = np .linspace (0.0 , 2.0 , 5 )
137
- omegas = np .linspace (0.0 , 2.0 , 5 )
137
+ gammas = np .linspace (0.0 , 2.0 , 7 )
138
+ omegas = np .linspace (0.0 , 2.0 , 7 )
138
139
parallelization = self .run_multilayer_graph_parallelization (G_intralayer , G_interlayer ,
139
140
layer_membership , gammas , omegas )
140
141
self .assertGreater (parallelization , PERFORMANCE_TARGET_RELATIVE_TO_PERFECT_SCALING )
0 commit comments