void check_results(std::vector<std::future<Value>>& futures) { std::vector<Value> results; for (auto& f_item : futures) { auto item = f_item.get(); results.push_back(item); } validate_results(results); }
void check_exceptions(std::vector<std::future<Value>>& futures) { std::vector<Value> results; for (auto& f_item : futures) { try { auto item = f_item.get(); } catch (const ValueException& e) { results.push_back(e.get_result()); } } test_assert(results.size() == futures.size(), "invalid result"); validate_results(results); }
void test_texture_mipmap_get_set (void) { cg_texture_t *texture = make_texture (); cg_framebuffer_orthographic (test_fb, 0, 0, cg_framebuffer_get_width (test_fb), cg_framebuffer_get_height (test_fb), -1, 100); update_mipmap_levels (texture); paint (texture); validate_results (); if (test_verbose ()) c_print ("OK\n"); }
int main() { #define N 8 int i; float x_ref[N], y_ref[N]; float x[N], y[N]; cublasHandle_t h; float a = 2.0; for (i = 0; i < N; i++) { x[i] = x_ref[i] = 4.0 + i; y[i] = y_ref[i] = 3.0; } saxpy (N, a, x_ref, y_ref); cublasCreate (&h); #pragma acc data copyin (x[0:N]) copy (y[0:N]) { #pragma acc host_data use_device (x, y) { cublasSaxpy (h, N, &a, x, 1, y, 1); } } validate_results (N, y, y_ref); #pragma acc data create (x[0:N]) copyout (y[0:N]) { #pragma acc kernels for (i = 0; i < N; i++) y[i] = 3.0; #pragma acc host_data use_device (x, y) { cublasSaxpy (h, N, &a, x, 1, y, 1); } } cublasDestroy (h); validate_results (N, y, y_ref); for (i = 0; i < N; i++) y[i] = 3.0; /* There's no need to use host_data here. */ #pragma acc data copyin (x[0:N]) copyin (a) copy (y[0:N]) { #pragma acc parallel present (x[0:N]) pcopy (y[0:N]) present (a) saxpy (N, a, x, y); } validate_results (N, y, y_ref); /* Exercise host_data with data transferred with acc enter data. */ for (i = 0; i < N; i++) y[i] = 3.0; #pragma acc enter data copyin (x, a, y) #pragma acc parallel present (x[0:N]) pcopy (y[0:N]) present (a) { saxpy (N, a, x, y); } #pragma acc exit data delete (x, a) copyout (y) validate_results (N, y, y_ref); return 0; }