gt: mpi sum err and time, enable all
This commit is contained in:
@@ -374,9 +374,9 @@ template <int Dim, typename S>
|
|||||||
void print_test_name(bool use_buffers)
|
void print_test_name(bool use_buffers)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same<S, gt::space::device>::value) {
|
if constexpr (std::is_same<S, gt::space::device>::value) {
|
||||||
printf("=== TEST dim:%d, device , buf:%d\n", Dim, use_buffers);
|
printf("TEST dim:%d, device , buf:%d", Dim, use_buffers);
|
||||||
} else {
|
} else {
|
||||||
printf("=== TEST dim:%d, managed, buf:%d\n", Dim, use_buffers);
|
printf("TEST dim:%d, managed, buf:%d", Dim, use_buffers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,10 +411,6 @@ void test(int device_id, uint32_t vendor_id, int world_size, int world_rank,
|
|||||||
ny_local_ghost = n_local + 2 * n_bnd;
|
ny_local_ghost = n_local + 2 * n_bnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world_rank == 0) {
|
|
||||||
print_test_name<Dim, S>(use_buffers);
|
|
||||||
}
|
|
||||||
|
|
||||||
gt::shape_type<2> z_shape(nx_local_ghost, ny_local_ghost);
|
gt::shape_type<2> z_shape(nx_local_ghost, ny_local_ghost);
|
||||||
gt::shape_type<2> dz_shape(nx_local, ny_local);
|
gt::shape_type<2> dz_shape(nx_local, ny_local);
|
||||||
|
|
||||||
@@ -534,8 +530,10 @@ void test(int device_id, uint32_t vendor_id, int world_size, int world_rank,
|
|||||||
}
|
}
|
||||||
gt::synchronize();
|
gt::synchronize();
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
printf("%d/%d exchange time %0.8f ms\n", world_rank, world_size,
|
printf("%d/%d exchange time %0.8f ms\n", world_rank, world_size,
|
||||||
total_time / n_iter * 1000);
|
total_time / n_iter * 1000);
|
||||||
|
#endif
|
||||||
|
|
||||||
gt::copy(d_dz_numeric, h_dz_numeric);
|
gt::copy(d_dz_numeric, h_dz_numeric);
|
||||||
|
|
||||||
@@ -553,8 +551,21 @@ void test(int device_id, uint32_t vendor_id, int world_size, int world_rank,
|
|||||||
|
|
||||||
double err_norm = std::sqrt(gt::sum_squares(h_dz_numeric - h_dz_actual));
|
double err_norm = std::sqrt(gt::sum_squares(h_dz_numeric - h_dz_actual));
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
printf("%d/%d [%d:0x%08x] err_norm = %.8f\n", world_rank, world_size,
|
printf("%d/%d [%d:0x%08x] err_norm = %.8f\n", world_rank, world_size,
|
||||||
device_id, vendor_id, err_norm);
|
device_id, vendor_id, err_norm);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double time_sum;
|
||||||
|
MPI_Reduce(&total_time, &time_sum, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
|
||||||
|
|
||||||
|
double err_sum;
|
||||||
|
MPI_Reduce(&err_norm, &err_sum, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
|
||||||
|
|
||||||
|
if (world_rank == 0) {
|
||||||
|
print_test_name<Dim, S>(use_buffers);
|
||||||
|
printf("; %0.8f, err=%0.8f\n", time_sum, err_sum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@@ -603,23 +614,23 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
// test<gt::space::device, 0>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::device, 0>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, true, 5);
|
n_global, n_iter, true, 5);
|
||||||
// test<gt::space::device, 0>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::device, 0>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, false, 5);
|
n_global, n_iter, false, 5);
|
||||||
// test<gt::space::managed, 0>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::managed, 0>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, true, 5);
|
n_global, n_iter, true, 5);
|
||||||
// test<gt::space::managed, 0>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::managed, 0>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, false, 5);
|
n_global, n_iter, false, 5);
|
||||||
|
|
||||||
test<gt::space::device, 1>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::device, 1>(device_id, vendor_id, world_size, world_rank,
|
||||||
n_global, n_iter, true, 5);
|
n_global, n_iter, true, 5);
|
||||||
test<gt::space::device, 1>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::device, 1>(device_id, vendor_id, world_size, world_rank,
|
||||||
n_global, n_iter, false, 5);
|
n_global, n_iter, false, 5);
|
||||||
// test<gt::space::managed, 1>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::managed, 1>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, true, 5);
|
n_global, n_iter, true, 5);
|
||||||
// test<gt::space::managed, 1>(device_id, vendor_id, world_size, world_rank,
|
test<gt::space::managed, 1>(device_id, vendor_id, world_size, world_rank,
|
||||||
// n_global, n_iter, false, 5);
|
n_global, n_iter, false, 5);
|
||||||
|
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user