| 410 | } |
| 411 | |
| 412 | void parallel_memcpy(void* to, void* from, size_t n_bytes) |
| 413 | { |
| 414 | #if TARGET_RISCV |
| 415 | size_t vl = __riscv_vsetvl_e8m1(n_bytes); |
| 416 | vector_length_in_bytes = vl; |
| 417 | #endif |
| 418 | auto aligned_bytes = n_bytes - (n_bytes % vector_length_in_bytes); |
| 419 | // process aligned part |
| 420 | #pragma omp parallel for |
| 421 | for (int i = 0; i < aligned_bytes; i += vector_length_in_bytes) { |
| 422 | auto val = VLOAD_U8((char*)from + i); |
| 423 | VSTORE_U8((char*)to + i, val); |
| 424 | } |
| 425 | |
| 426 | // process remaining part |
| 427 | for (int i = aligned_bytes; i < n_bytes; i++) { *((char*)to + i) = *((char*)from + i); } |
| 428 | } |
| 429 | |
| 430 | #define positive_mod(num, mod) ((((num) % (mod)) + (mod)) % (mod)) |
| 431 | #define rank_mod(rank) positive_mod(rank, world_size) |
no outgoing calls
no test coverage detected