MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / WorkerMixin

Class WorkerMixin

include/core/solver.h:1171–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1169 */
1170template<class _Solver>
1171class WorkerMixin {
1172public:
1173 typedef _Solver Solver;
1174 typedef typename Solver::Float Float;
1175 typedef typename Solver::Index Index;
1176 typedef typename Solver::Vector Vector;
1177 typedef typename Solver::EdgeSample EdgeSample;
1178
1179 static const int kSampleSize = Solver::kSampleSize;
1180
1181 Solver *solver;
1182 int device_id;
1183 Optimizer optimizer;
1184 cudaStream_t work_stream, sample_stream;
1185 Index head_partition_size, tail_partition_size;
1186 std::vector<std::shared_ptr<Memory<Vector, Index>>> embeddings, gradients;
1187 std::vector<std::shared_ptr<std::vector<Memory<Vector, Index>>>> moments;
1188 int head_partition_id, tail_partition_id;
1189 std::vector<Index> head_global_ids, tail_global_ids;
1190 std::vector<Protocol> protocols;
1191 Protocol sampler_protocol;
1192 AliasTable<Float, Index> negative_sampler;
1193 Memory<Index, int> batch, negative_batch;
1194 Memory<Float, int> logits, loss;
1195 Memory<double, int> random;
1196 curandGenerator_t generator;
1197 int num_moment;
1198 int num_embedding, num_negative, batch_size;
1199 int log_frequency;
1200
1201#define USING_WORKER_MIXIN(type) \
1202 using typename type::Solver; \
1203 using typename type::Float; \
1204 using typename type::Index; \
1205 using typename type::Vector; \
1206 using type::solver; \
1207 using type::work_stream; \
1208 using type::head_partition_size; \
1209 using type::tail_partition_size; \
1210 using type::head_partition_id; \
1211 using type::tail_partition_id; \
1212 using type::head_global_ids; \
1213 using type::tail_global_ids; \
1214 using type::negative_sampler; \
1215 using type::batch; \
1216 using type::negative_batch; \
1217 using type::logits; \
1218 using type::loss; \
1219 using type::batch_size; \
1220 using type::embeddings; \
1221 using type::moments; \
1222 using type::gradients; \
1223 using type::num_moment; \
1224 using type::optimizer
1225
1226 /**
1227 * Construct a general training worker
1228 * @param _solver pointer to graph embedding solver

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected