From 8bbed3573616ade1e578116f18be565a3c66ae8e Mon Sep 17 00:00:00 2001 From: tqchen Date: Thu, 28 May 2015 10:44:19 -0700 Subject: [PATCH] modify --- Makefile | 9 ++++++++- guide/basic.cc | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e2a96eb43..2260148de 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,14 @@ endif export MPICXX = mpicxx export LDFLAGS= -Llib -lrt export WARNFLAGS= -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -pedantic -export CFLAGS = -O3 -msse2 -fPIC $(WARNFLAGS) +export CFLAGS = -O3 -msse2 $(WARNFLAGS) + +ifndef WITH_FPIC + WITH_FPIC = 1 +endif +ifeq ($(WITH_FPIC), 1) + CFLAGS += -fPIC +endif # build path BPATH=. diff --git a/guide/basic.cc b/guide/basic.cc index 62c0fc165..803ce7466 100644 --- a/guide/basic.cc +++ b/guide/basic.cc @@ -5,11 +5,15 @@ * * \author Tianqi Chen */ +#include #include using namespace rabit; -const int N = 3; int main(int argc, char *argv[]) { - int a[N]; + int N = 3; + if (argc > 1) { + N = atoi(argv[1]); + } + std::vector a(N); rabit::Init(argc, argv); for (int i = 0; i < N; ++i) { a[i] = rabit::GetRank() + i;