@@ -153,7 +153,6 @@ UCS_TEST_SKIP_COND_F(test_arch, memcpy, RUNNING_ON_VALGRIND || !ucs::perf_retry_
153153 char memunits_str[256 ];
154154 char thresh_min_str[16 ];
155155 char thresh_max_str[16 ];
156- int i;
157156
158157 ucs_memunits_to_str (ucs_global_opts.arch .builtin_memcpy_min ,
159158 thresh_min_str, sizeof (thresh_min_str));
@@ -163,20 +162,25 @@ UCS_TEST_SKIP_COND_F(test_arch, memcpy, RUNNING_ON_VALGRIND || !ucs::perf_retry_
163162 thresh_min_str << " .." <<
164163 thresh_max_str;
165164 for (size = 4096 ; size <= 256 * UCS_MBYTE; size *= 2 ) {
166- secs = ucs_get_accurate_time ();
167- for (i = 0 ; ucs_get_accurate_time () - secs < timeout; i++) {
168- memcpy_bw = measure_memcpy_bandwidth<memcpy>(size);
169- memcpy_relax_bw = measure_memcpy_bandwidth<memcpy_relaxed>(size);
170- if (memcpy_relax_bw / memcpy_bw >= diff) {
165+ for (int retry = 0 ; retry < (ucs::perf_retry_count + 1 ); ++retry) {
166+ secs = ucs_get_accurate_time ();
167+ do {
168+ memcpy_bw = measure_memcpy_bandwidth<memcpy>(size);
169+ memcpy_relax_bw = measure_memcpy_bandwidth<memcpy_relaxed>(size);
170+ if (memcpy_relax_bw / memcpy_bw >= diff) {
171+ break ;
172+ }
173+ usleep (1000 ); /* allow other tasks to complete */
174+ } while ((ucs_get_accurate_time () - secs) < timeout);
175+ ucs_memunits_to_str (size, memunits_str, sizeof (memunits_str));
176+ UCS_TEST_MESSAGE << memunits_str <<
177+ " memcpy: " << (memcpy_bw / UCS_GBYTE) <<
178+ " GB/s memcpy relaxed: " << (memcpy_relax_bw / UCS_GBYTE) <<
179+ " (attempt " << (retry + 1 ) << " /" << ucs::perf_retry_count << " )" ;
180+ if ((memcpy_relax_bw / memcpy_bw)>= diff) {
171181 break ;
172182 }
173- usleep (1000 ); /* allow other tasks to complete */
174183 }
175- ucs_memunits_to_str (size, memunits_str, sizeof (memunits_str));
176- UCS_TEST_MESSAGE << memunits_str <<
177- " memcpy: " << (memcpy_bw / UCS_GBYTE) <<
178- " GB/s memcpy relaxed: " << (memcpy_relax_bw / UCS_GBYTE) <<
179- " GB/s iterations: " << i + 1 ;
180184 EXPECT_GE (memcpy_relax_bw / memcpy_bw, diff);
181185 }
182186}
0 commit comments