IntelĀ® Machine Learning Scaling Library  2018
A library providing an efficient implementation of communication patterns used in deep learning.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Static Public Member Functions | List of all members
MLSL::Environment Class Reference

A singleton object that holds global Intel MLSL functions. More...

#include <mlsl.hpp>

Public Member Functions

void Configure (const char *config=NULL)
 
void Init (int *argc, char **argv[])
 
void Finalize ()
 
bool IsInitialized ()
 
size_t GetProcessIdx ()
 
size_t GetProcessCount ()
 
SessionCreateSession (PhaseType phaseType=PT_TRAIN)
 
void DeleteSession (Session *session)
 
DistributionCreateDistribution (size_t dataPartitions, size_t modelPartitions)
 
DistributionCreateDistributionWithColors (int dataColor, int modelColor)
 
void DeleteDistribution (Distribution *distribution)
 
void Wait (CommReq *req)
 
void Test (CommReq *req, bool *isCompleted)
 
void * Alloc (size_t size, size_t alignment)
 
void Free (void *ptr)
 
void SetQuantizationParams (QuantParams *params)
 
QuantParamsGetQuantizationParams ()
 

Static Public Member Functions

static EnvironmentGetEnv ()
 
static int GetVersion ()
 

Detailed Description

A singleton object that holds global Intel MLSL functions.

Member Function Documentation

void* MLSL::Environment::Alloc ( size_t  size,
size_t  alignment 
)

Intel MLSL specific allocation function. Should be used to allocate communication buffers. Allocates size bytes and returns a pointer to the allocated memory. The memory address will be a multiple of alignment, which must be a power of two.

Parameters
sizethe number of bytes to allocate
alignmentthe return pointer alignment
Returns
A pointer to the allocated memory, or NULL if the allocation fails.
void MLSL::Environment::Configure ( const char *  config = NULL)

An optional method to allow passing configuration information e.g. configuration file name.
For the MPI backend this may be NULL, but may be handy for the gRPC or ZMQ implementation.

Parameters
configa configuration string or the path to a configuration file (optional)
Distribution* MLSL::Environment::CreateDistribution ( size_t  dataPartitions,
size_t  modelPartitions 
)

Creates a new Distribution object.

Parameters
dataPartitionsthe number of partitions for data (partitions on global mini-batch)
modelPartitionsthe number of partitions for model (partitions on input activation)
Returns
A distribution.
Distribution* MLSL::Environment::CreateDistributionWithColors ( int  dataColor,
int  modelColor 
)

Creates a new Distribution object based on process colors passed. Don't use this method unless you absolutely need it.

Parameters
dataColordefines partitions on global mini-batch. Processes with the same dataColor get into the same data group
modelColordefines partitions on input activation. Processes with the same modelColor get into the same model group
Returns
A distribution.
Session* MLSL::Environment::CreateSession ( PhaseType  phaseType = PT_TRAIN)

Creates a new Session object.

Parameters
phaseTypethe phase type (optional), can be used for internal optimizations
Returns
A session.
void MLSL::Environment::DeleteDistribution ( Distribution distribution)

Deletes the previously created Distribution object.

Parameters
distributionthe distribution to delete
void MLSL::Environment::DeleteSession ( Session session)

Deletes the previously created Session object.

Parameters
sessionthe session to delete
void MLSL::Environment::Finalize ( )

Finalizes the library, cleans up and frees all the internally allocated memory.

void MLSL::Environment::Free ( void *  ptr)

Intel MLSL specific deallocation function. Frees the memory that was previously allocated with Alloc().

Parameters
ptrthe pointer to the memory to be deallocated
static Environment& MLSL::Environment::GetEnv ( )
static
Returns
An Environment class instance.
size_t MLSL::Environment::GetProcessCount ( )
Returns
The global number of processes.
size_t MLSL::Environment::GetProcessIdx ( )
Returns
The global process index.
QuantParams* MLSL::Environment::GetQuantizationParams ( )
Returns
A pointer to the structure that contains information about quantization library.
static int MLSL::Environment::GetVersion ( )
static
Returns
The full Intel MLSL API version.
void MLSL::Environment::Init ( int *  argc,
char **  argv[] 
)

Initializes the library. Must precede any other library calls (except static methods of the Environment class).

Parameters
argca pointer to the number of arguments
argvan argument vector
bool MLSL::Environment::IsInitialized ( )
Returns
True if Init() has been called, false otherwise.
void MLSL::Environment::SetQuantizationParams ( QuantParams params)

Sets quantization parameters. Quantization parameters must be set before calling OperationRegInfo::AddParameterSet() with quantization enabled.

Parameters
paramsthe data structure containing information about the quantization library
void MLSL::Environment::Test ( CommReq req,
bool *  isCompleted 
)

Tests for completion of a communication request.

Parameters
reqthe communication request
isCompletedthe completion status of the request, true if request is completed, false otherwise
void MLSL::Environment::Wait ( CommReq req)

Waits for a communication request to complete.

Parameters
reqthe communication request

The documentation for this class was generated from the following file: