Turi Create
4.0
|
#include <core/system/lambda/lambda_master.hpp>
Public Member Functions | |
lambda_master (size_t nworkers) | |
size_t | make_lambda (const std::string &lambda_str) |
void | release_lambda (size_t lambda_hash) noexcept |
void | bulk_eval (size_t lambda_hash, const std::vector< flexible_type > &args, std::vector< flexible_type > &out, bool skip_undefined, uint64_t seed) |
void | bulk_eval (size_t lambda_hash, const sframe_rows &args, std::vector< flexible_type > &out, bool skip_undefined, uint64_t seed) |
void | bulk_eval (size_t lambda_hash, const std::vector< std::string > &keys, const std::vector< std::vector< flexible_type >> &args, std::vector< flexible_type > &out, bool skip_undefined, uint64_t seed) |
void | bulk_eval (size_t lambda_hash, const std::vector< std::string > &keys, const sframe_rows &args, std::vector< flexible_type > &out, bool skip_undefined, uint64_t seed) |
The lambda_master provides functions to evaluate a lambda function on different input types (single value, list, dictionary) in parallel.
set_lambda_worker_binary or must be called first to inform the location of the lambda worker binaries.
Internally, it manages a worker pool of lambda_workers.
Each evaluation call is allocated to a worker, and block until the evaluation returns or throws an exception.
The evaluation functions can be called in parallel. When this happens, the master evenly allocates the jobs to workers who has the shortest job queue.
Definition at line 75 of file lambda_master.hpp.
turi::lambda::lambda_master::lambda_master | ( | size_t | nworkers | ) |
Constructor. Do not use directly. Instead, use get_instance()
void turi::lambda::lambda_master::bulk_eval | ( | size_t | lambda_hash, |
const std::vector< flexible_type > & | args, | ||
std::vector< flexible_type > & | out, | ||
bool | skip_undefined, | ||
uint64_t | seed | ||
) |
Evaluate lambda on batch of inputs.
void turi::lambda::lambda_master::bulk_eval | ( | size_t | lambda_hash, |
const sframe_rows & | args, | ||
std::vector< flexible_type > & | out, | ||
bool | skip_undefined, | ||
uint64_t | seed | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void turi::lambda::lambda_master::bulk_eval | ( | size_t | lambda_hash, |
const std::vector< std::string > & | keys, | ||
const std::vector< std::vector< flexible_type >> & | args, | ||
std::vector< flexible_type > & | out, | ||
bool | skip_undefined, | ||
uint64_t | seed | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Lambda takes dictionary argument.
void turi::lambda::lambda_master::bulk_eval | ( | size_t | lambda_hash, |
const std::vector< std::string > & | keys, | ||
const sframe_rows & | args, | ||
std::vector< flexible_type > & | out, | ||
bool | skip_undefined, | ||
uint64_t | seed | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
size_t turi::lambda::lambda_master::make_lambda | ( | const std::string & | lambda_str | ) |
Register the lambda_str for all workers, and returns the id for the lambda. Throws the exception
|
noexcept |
Unregister the lambda_str.