void shmem_parallel_for_nbi(void (*body)(void *), void *user_data, shmem_future_t **optional_future, int lowBound, int highBound, int stride, int tile_size, int loop_dimension, int loop_mode) { loop_domain_t info = { lowBound, highBound, stride, tile_size}; hclib_forasync(body, user_data, optional_future, loop_dimension, &info, loop_mode); }
hclib_future_t *hclib_forasync_future(void *forasync_fct, void *argv, int dim, hclib_loop_domain_t *domain, forasync_mode_t mode) { hclib_start_finish(); hclib_forasync(forasync_fct, argv, dim, domain, mode); return hclib_end_finish_nonblocking(); }
void entrypoint(void *arg) { int *ran = (int *)arg; // This is ok to have these on stack because this // code is alive until the end of the program. init_ran(ran, H1*H2); loop_domain_t loop0 = {0,H1,1,T1}; loop_domain_t loop1 = {0,H2,1,T2}; loop_domain_t loop[2] = {loop0, loop1}; hclib_start_finish(); hclib_forasync(forasync_fct2, (void*)(ran), NULL, 2, loop, FORASYNC_MODE_RECURSIVE); hclib_end_finish(); printf("Call Finalize\n"); }