remove c++11

This commit is contained in:
tqchen 2014-12-22 01:10:14 -08:00
parent 7a2ae105ea
commit bb2ecc6ad5
3 changed files with 13 additions and 6 deletions

View File

@ -2,16 +2,16 @@ export CC = gcc
export CXX = g++
export MPICXX = mpicxx
export LDFLAGS= -pthread -lm -L../lib
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -I../include -std=c++11
export CFLAGS = -Wall -O3 -msse2 -Wno-unknown-pragmas -fPIC -I../include
# specify tensor path
BIN = kmeans
BIN = kmeans.rabit
# objectives that makes up rabit library
OBJ = kmeans.o
MPIBIN = kmeans.mpi
.PHONY: clean all lib
all: $(BIN) $(MPIBIN)
all: $(BIN)
lib:
cd ..;make;cd -
@ -19,7 +19,7 @@ lib:
kmeans.o: kmeans.cpp ../src/*.h
# we can link against MPI version to get use MPI
kmeans: kmeans.o lib
kmeans.rabit: kmeans.o lib
kmeans.mpi: kmeans.o lib
$(BIN) :

View File

@ -115,7 +115,10 @@ int main(int argc, char *argv[]) {
Matrix temp;
for (int r = iter; r < max_iter; ++r) {
temp.Init(num_cluster, num_feat + 1, 0.0f);
auto lazy_get_centroid = [&]() {
#if __cplusplus >= 201103L
auto lazy_get_centroid = [&]()
#endif
{
// lambda function used to calculate the data if necessary
// this function may not be called when the result can be directly recovered
const size_t ndata = data.NumRow();
@ -131,7 +134,11 @@ int main(int argc, char *argv[]) {
}
};
// call allreduce
#if __cplusplus >= 201103L
rabit::Allreduce<op::Sum>(&temp.data[0], temp.data.size(), lazy_get_centroid);
#else
rabit::Allreduce<op::Sum>(&temp.data[0], temp.data.size());
#endif
// set number
for (int k = 0; k < num_cluster; ++k) {
float cnt = temp[k][num_feat];

View File

@ -6,4 +6,4 @@ then
fi
#set path to hadoop streaming jar here
STREAMING_JAR=
python ../rabit_hadoop.py -hs $STREAMING_JAR -s $1 -i $2 -m kmeans --args "stdin "$3" "$4" stdout" -o $5
python ../rabit_hadoop.py -hs $STREAMING_JAR -s $1 -i $2 -m kmeans.rabit --args "stdin "$3" "$4" stdout" -o $5