Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the nccl wrapper for --cupy-no-cuda #2724

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions cupy/cuda/cupy_nccl.h
@@ -0,0 +1,45 @@
// This file is a stub header file of cudnn for Read the Docs.

#ifndef INCLUDE_GUARD_CUPY_NCCL_H
#define INCLUDE_GUARD_CUPY_NCCL_H

#ifndef CUPY_NO_CUDA

#include <nccl.h>

#else // #ifndef CUPY_NO_CUDA

extern "C" {

typedef struct ncclComm* ncclComm_t;

enum {
NCCL_UNIQUE_ID_BYTES = 128
};
typedef struct {
char internal[NCCL_UNIQUE_ID_BYTES];
} ncclUniqueId;

typedef enum {
ncclSuccess
} ncclResult_t;

typedef enum {} ncclRedOp_t;

typedef enum {} ncclDataType_t;

const char* ncclGetErrorString(...);
ncclResult_t ncclGetUniqueId(...);
ncclResult_t ncclCommInitRank(...);
void ncclCommDestroy(...);
ncclResult_t ncclCommCuDevice(...);
ncclResult_t ncclCommUserRank(...);
ncclResult_t ncclAllReduce(...);
ncclResult_t ncclReduce(...);
ncclResult_t ncclBcast(...);

}

#endif // #ifndef CUPY_NO_CUDA

#endif // #ifndef INCLUDE_GUARD_CUPY_NCCL_H
4 changes: 3 additions & 1 deletion cupy/cuda/nccl.pyx
@@ -1,11 +1,13 @@
# distutils: language = c++

"""
Wrapper for NCCL: Optimized primiteive for collective multi-GPU communication
"""
cimport cython

from cupy.cuda cimport driver

cdef extern from "nccl.h":
cdef extern from "cupy_nccl.h":
ctypedef struct ncclComm:
pass
ctypedef ncclComm* ncclComm_t
Expand Down