Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo #102

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions include/ps/internal/assign_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ enum AssignOp {
};

/**
* \brief return an assignment function: right op= left
* \brief return an assignment function: rhs op= lhs
*/
template<typename T>
inline void AssignFunc(const T& lhs, AssignOp op, T* rhs) {
switch (op) {
case ASSIGN:
*right = left; break;
*rhs = lhs; break;
case PLUS:
*right += left; break;
*rhs += lhs; break;
case MINUS:
*right -= left; break;
*rhs -= lhs; break;
case TIMES:
*right *= left; break;
*rhs *= lhs; break;
case DIVIDE:
*right /= left; break;
*rhs /= lhs; break;
default:
LOG(FATAL) << "use AssignOpInt..";
}
Expand All @@ -49,21 +49,21 @@ template<typename T>
inline void AssignFuncInt(const T& lhs, AssignOp op, T* rhs) {
switch (op) {
case ASSIGN:
*right = left; break;
*rhs = lhs; break;
case PLUS:
*right += left; break;
*rhs += lhs; break;
case MINUS:
*right -= left; break;
*rhs -= lhs; break;
case TIMES:
*right *= left; break;
*rhs *= lhs; break;
case DIVIDE:
*right /= left; break;
*rhs /= lhs; break;
case AND:
*right &= left; break;
*rhs &= lhs; break;
case OR:
*right |= left; break;
*rhs |= lhs; break;
case XOR:
*right ^= left; break;
*rhs ^= lhs; break;
}
}

Expand Down
4 changes: 2 additions & 2 deletions include/ps/internal/parallel_kv_match.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ template <typename K, typename V>
void ParallelOrderedMatch(
const K* src_key, const K* src_key_end, const V* src_val,
const K* dst_key, const K* dst_key_end, V* dst_val,
int k, AsOp op, size_t grainsize, size_t* n) {
int k, AssignOp op, size_t grainsize, size_t* n) {
size_t src_len = std::distance(src_key, src_key_end);
size_t dst_len = std::distance(dst_key, dst_key_end);
if (dst_len == 0 || src_len == 0) return;
Expand All @@ -46,7 +46,7 @@ void ParallelOrderedMatch(
} else {
if (!(*dst_key < *src_key)) {
for (int i = 0; i < k; ++i) {
AssignOp(dst_val[i], src_val[i], op);
AssignFunc(dst_val[i], src_val[i], op);
}
++src_key; src_val += k;
*n += k;
Expand Down
5 changes: 3 additions & 2 deletions src/van.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ps {
// don't send heartbeast in default. because if the scheduler received a
// heartbeart signal from a node before connected to that node, then it could be
// problem.
const static int kDefaultHeartbeatInterval = 0;
static const int kDefaultHeartbeatInterval = 0;

Van* Van::Create(const std::string& type) {
if (type == "zmq") {
Expand Down Expand Up @@ -140,7 +140,8 @@ int Van::Send(const Message& msg) {

void Van::Receiving() {
const char* heartbeat_timeout_val = Environment::Get()->find("PS_HEARTBEAT_TIMEOUT");
const int heartbeat_timeout = heartbeat_timeout_val ? atoi(heartbeat_timeout_val) : kDefaultHeartbeatInterval;
const int heartbeat_timeout = heartbeat_timeout_val ? atoi(heartbeat_timeout_val)
: kDefaultHeartbeatInterval;
Meta nodes; // for scheduler usage
while (true) {
Message msg;
Expand Down