AI-MXNetCAPI
view release on metacpan or search on metacpan
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreGetRank(KVStoreHandle handle,
int *out);
/**
* \brief return The number of nodes in this group, which is
* - number of workers if if `IsWorkerNode() == true`,
* - number of servers if if `IsServerNode() == true`,
* - 1 if `IsSchedulerNode() == true`,
* \param handle handle to the KVStore
* \param ret the group size
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreGetGroupSize(KVStoreHandle handle,
int *out);
/**
* \brief return whether or not this process is a worker node.
* \param ret 1 for yes, 0 for no
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreIsWorkerNode(int *out);
/**
* \brief return whether or not this process is a server node.
* \param ret 1 for yes, 0 for no
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreIsServerNode(int *out);
/**
* \brief return whether or not this process is a scheduler node.
* \param ret 1 for yes, 0 for no
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreIsSchedulerNode(int *out);
/**
* \brief global barrier among all worker machines
*
* \param handle handle to the KVStore
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreBarrier(KVStoreHandle handle);
/**
* \brief whether to do barrier when finalize
*
* \param handle handle to the KVStore
* \param barrier_before_exit whether to do barrier when kvstore finalize
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle,
const int barrier_before_exit);
/**
* \brief the prototype of a server controller
* \param head the head of the command
* \param body the body of the command
* \param controller_handle helper handle for implementing controller
*/
typedef void (MXKVStoreServerController)(int head,
const char *body,
void *controller_handle);
/**
* \return Run as server (or scheduler)
*
* \param handle handle to the KVStore
* \param controller the user-defined server controller
* \param controller_handle helper handle for implementing controller
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreRunServer(KVStoreHandle handle,
MXKVStoreServerController controller,
void *callback_handle);
/**
* \return Send a command to all server nodes
*
* \param handle handle to the KVStore
* \param cmd_id the head of the command
* \param cmd_body the body of the command
* \return 0 when success, -1 when failure happens
*/
int MXKVStoreSendCommmandToServers(KVStoreHandle handle,
int cmd_id,
const char* cmd_body);
/**
* \brief Get the number of ps dead node(s) specified by {node_id}
*
* \param handle handle to the KVStore
* \param node_id Can be a node group or a single node.
* kScheduler = 1, kServerGroup = 2, kWorkerGroup = 4
* \param number Ouptut number of dead nodes
* \param timeout_sec A node fails to send heartbeart in {timeout_sec} seconds
* will be presumed as 'dead'
*/
int MXKVStoreGetNumDeadNode(KVStoreHandle handle,
const int node_id,
int *out,
const int timeout_sec = 60);
/**
* \brief Create a RecordIO writer object
* \param uri path to file
* \param out handle pointer to the created object
* \return 0 when success, -1 when failure happens
*/
int MXRecordIOWriterCreate(const char *uri, RecordIOHandle *out);
/**
* \brief Delete a RecordIO writer object
* \param handle handle to RecordIO object
* \return 0 when success, -1 when failure happens
*/
int MXRecordIOWriterFree(RecordIOHandle handle);
/**
* \brief Write a record to a RecordIO object
* \param handle handle to RecordIO object
* \param buf buffer to write
* \param size size of buffer
* \return 0 when success, -1 when failure happens
*/
int MXRecordIOWriterWriteRecord(RecordIOHandle handle,
const char *buf, size_t size);
/**
* \brief Get the current writer pointer position
* \param handle handle to RecordIO object
* \param pos handle to output position
* \return 0 when success, -1 when failure happens
*/
int MXRecordIOWriterTell(RecordIOHandle handle, size_t *out);
/**
* \brief Create a RecordIO reader object
* \param uri path to file
* \param out handle pointer to the created object
* \return 0 when success, -1 when failure happens
*/
( run in 1.576 second using v1.01-cache-2.11-cpan-f56aa216473 )