Neko
1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_nccl.c
Go to the documentation of this file.
1
/*
2
Copyright (c) 2025, The Neko Authors
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions
7
are met:
8
9
* Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
11
12
* Redistributions in binary form must reproduce the above
13
copyright notice, this list of conditions and the following
14
disclaimer in the documentation and/or other materials provided
15
with the distribution.
16
17
* Neither the name of the authors nor the names of its
18
contributors may be used to endorse or promote products derived
19
from this software without specific prior written permission.
20
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
POSSIBILITY OF SUCH DAMAGE.
33
*/
34
39
#include <stdlib.h>
40
#include <stdio.h>
41
#include <
comm/comm_nccl.h
>
42
43
void
device_nccl_sendrecv
(
void
*
sbuf_d
,
int
soffset
,
int
scount
,
int
srank
,
44
void
*
rbuf_d
,
int
roffset
,
int
rcount
,
int
rrank
,
45
int
nbytes
,
void
*stream) {
46
47
#if defined(HAVE_NCCL) || defined(HAVE_RCCL)
48
if
(
nbytes
==
sizeof
(
float
)) {
49
ncclGroupStart
();
50
ncclSend
(
sbuf_d
+
soffset
,
scount
,
ncclFloat
,
srank
,
NEKO_COMM_NCCL
, stream);
51
ncclRecv
(
rbuf_d
+
roffset
,
rcount
,
ncclFloat
,
rrank
,
NEKO_COMM_NCCL
, stream);
52
ncclGroupEnd
();
53
}
54
else
if
(
nbytes
==
sizeof
(
double
)) {
55
ncclGroupStart
();
56
ncclSend
(
sbuf_d
+
soffset
,
scount
,
ncclFloat64
,
srank
,
NEKO_COMM_NCCL
, stream);
57
ncclRecv
(
rbuf_d
+
roffset
,
rcount
,
ncclFloat64
,
rrank
,
NEKO_COMM_NCCL
, stream);
58
ncclGroupEnd
();
59
}
60
else
{
61
fprintf
(
stderr
,
__FILE__
": Invalid data type)\n"
);
62
exit
(1);
63
}
64
#endif
65
}
comm_nccl.h
dirichlet_apply_scalar_kernel
__global__ void dirichlet_apply_scalar_kernel(const int *__restrict__ msk, T *__restrict__ x, const T g, const int m)
Definition
dirichlet_kernel.h:42
device_nccl_sendrecv
void device_nccl_sendrecv(void *sbuf_d, int soffset, int scount, int srank, void *rbuf_d, int roffset, int rcount, int rrank, int nbytes, void *stream)
Definition
device_nccl.c:43
src
gs
bcknd
device
device_nccl.c
Generated on Mon Sep 1 2025 03:49:14 for Neko by
1.9.8