Files
rocm-systems/ext-tuner/example/plugin.c
T

35 lines
1.3 KiB
C
Raw Normal View History

2023-09-26 05:47:28 -07:00
/*************************************************************************
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
*
* See LICENSE.txt for license information
************************************************************************/
#include "tuner.h"
#define __hidden __attribute__ ((visibility("hidden")))
2024-03-26 06:08:55 -07:00
__hidden ncclResult_t pluginInit(size_t nRanks, size_t nNodes, ncclDebugLogger_t logFunction, void **context) { return ncclSuccess; }
2023-09-26 05:47:28 -07:00
2024-03-26 06:08:55 -07:00
__hidden ncclResult_t pluginGetCollInfo(void* context, ncclFunc_t collType, size_t nBytes,
2024-06-11 01:28:01 -07:00
int numPipeOps, float** collCostTable, int numAlgo, int numProto,
2024-12-18 08:26:06 -08:00
int regBuff, int* nChannels) {
2024-06-11 01:28:01 -07:00
// Update NCCL core generated cost table. Updated table will be evaluated by NCCL to pick the best algo/proto combo
2024-12-18 08:26:06 -08:00
float (*table)[NCCL_NUM_PROTOCOLS] = (float (*)[NCCL_NUM_PROTOCOLS])collCostTable;
if (table[NCCL_ALGO_RING][NCCL_PROTO_SIMPLE] != NCCL_ALGO_PROTO_IGNORE) {
table[NCCL_ALGO_RING][NCCL_PROTO_SIMPLE] = 0.0;
2024-06-11 01:28:01 -07:00
}
*nChannels = 1;
return ncclSuccess;
}
2023-09-26 05:47:28 -07:00
2024-03-26 06:08:55 -07:00
__hidden ncclResult_t pluginDestroy(void* context) { return ncclSuccess; }
2023-09-26 05:47:28 -07:00
#define PLUGIN_NAME "Example"
2024-12-18 08:26:06 -08:00
const ncclTuner_v4_t ncclTunerPlugin_v4 = {
2023-09-26 05:47:28 -07:00
.name = PLUGIN_NAME,
.init = pluginInit,
.getCollInfo = pluginGetCollInfo,
.destroy = pluginDestroy
};