MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / parallel_memcpy

Function parallel_memcpy

csrc/cpu/comm/shm.cpp:412–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412void 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)

Callers 2

distributed_naive_reduceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected