GraphLab: Distributed Graph-Parallel API
2.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
dc_init_from_env.cpp
1
/**
2
* Copyright (c) 2009 Carnegie Mellon University.
3
* All rights reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an "AS
13
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
* express or implied. See the License for the specific language
15
* governing permissions and limitations under the License.
16
*
17
* For more about this software visit:
18
*
19
* http://www.graphlab.ml.cmu.edu
20
*
21
*/
22
23
24
#include <cstdio>
25
#include <cstdlib>
26
#include <string>
27
#include <graphlab/rpc/dc.hpp>
28
#include <graphlab/rpc/dc_init_from_env.hpp>
29
#include <graphlab/util/stl_util.hpp>
30
#include <
graphlab/logger/logger.hpp
>
31
namespace
graphlab {
32
33
bool
init_param_from_env
(
dc_init_param
& param) {
34
char
* nodeid = getenv(
"SPAWNID"
);
35
if
(nodeid == NULL) {
36
return
false
;
37
}
38
param.
curmachineid
= atoi(nodeid);
39
40
char
* nodes = getenv(
"SPAWNNODES"
);
41
std::string nodesstr = nodes;
42
if
(nodes == NULL) {
43
return
false
;
44
}
45
46
param.
machines
=
strsplit
(nodesstr,
","
);
47
for
(
size_t
i = 0;i < param.
machines
.size(); ++i) {
48
param.
machines
[i] = param.
machines
[i] +
":"
+
tostr
(10000 + i);
49
}
50
// set defaults
51
param.
numhandlerthreads
=
RPC_DEFAULT_NUMHANDLERTHREADS
;
52
param.
commtype
=
RPC_DEFAULT_COMMTYPE
;
53
return
true
;
54
}
55
56
}
// namespace graphlab
57
graphlab
rpc
dc_init_from_env.cpp
Generated on Mon Jun 3 2013 05:00:04 for GraphLab: Distributed Graph-Parallel API by
1.8.1.1