Files
rocm-systems/src/include/core.h
T

74 baris
1.9 KiB
C++
Mentah Pandangan Normal Riwayat

2018-09-24 16:06:59 -07:00
/*************************************************************************
2019-03-14 19:39:20 -07:00
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
* Modifications Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
2018-09-24 16:06:59 -07:00
*
* See LICENSE.txt for license information
************************************************************************/
#ifndef NCCL_CORE_H_
#define NCCL_CORE_H_
2019-03-14 19:39:20 -07:00
#include <pthread.h>
2018-09-24 16:06:59 -07:00
#include <unistd.h>
#include <stdlib.h>
2019-11-19 14:57:39 -08:00
#include <stdint.h>
#include <algorithm> // For std::min/std::max
#include "nccl.h"
2018-09-24 16:06:59 -07:00
#ifdef PROFAPI
#define NCCL_API(ret, func, args...) \
__attribute__ ((visibility("default"))) \
__attribute__ ((alias(#func))) \
ret p##func (args); \
extern "C" \
__attribute__ ((visibility("default"))) \
__attribute__ ((weak)) \
ret func(args)
#else
#define NCCL_API(ret, func, args...) \
extern "C" \
__attribute__ ((visibility("default"))) \
ret func(args)
#endif // end PROFAPI
2018-12-13 15:56:12 -08:00
static __inline__ int ncclTypeSize(ncclDataType_t type) {
switch (type) {
case ncclInt8:
case ncclUint8:
return 1;
case ncclFloat16:
2019-11-15 10:39:48 -08:00
case ncclBfloat16:
2018-12-13 15:56:12 -08:00
return 2;
case ncclInt32:
case ncclUint32:
case ncclFloat32:
return 4;
case ncclInt64:
case ncclUint64:
case ncclFloat64:
return 8;
default:
return -1;
}
}
2018-09-24 16:06:59 -07:00
2019-11-19 14:57:39 -08:00
#define NCCL_NUM_FUNCTIONS 5
typedef enum { ncclCollBroadcast, ncclCollReduce, ncclCollAllGather, ncclCollReduceScatter, ncclCollAllReduce } ncclFunc_t;
#define NCCL_NUM_ALGORITHMS 2 // Tree/Ring
#define NCCL_ALGO_TREE 0
#define NCCL_ALGO_RING 1
#define NCCL_NUM_PROTOCOLS 3 // Simple/LL/LL128
#define NCCL_PROTO_LL 0
#define NCCL_PROTO_LL128 1
#define NCCL_PROTO_SIMPLE 2
#include "debug.h"
#include "checks.h"
#include "alloc.h"
#include "utils.h"
#include "param.h"
2018-09-24 16:06:59 -07:00
#endif // end include guard