baidu-research / baidu-allreduce

Apache License 2.0
567 stars 113 forks source link

Small change needed to build by default on RHEL / Fedora / CentOS #6

Open frival opened 6 years ago

frival commented 6 years ago

I'm not sure why, but RHEL / Fedora / CentOS split their libraries and headers into separate directory structures in the openmpi / openmpi-devel packages. The below patch makes things work by default; perhaps MPI_INCLUDE_ROOT should default to MPI_ROOT to make things easier on OSes that don't have this split?

diff -u baidu-allreduce.orig/Makefile baidu-allreduce/Makefile
--- baidu-allreduce.orig/Makefile   2018-01-22 15:35:18.739557843 -0500
+++ baidu-allreduce/Makefile    2018-01-22 15:26:32.231119210 -0500
@@ -3,6 +3,11 @@
 $(error Could not find MPI in "$(MPI_ROOT)")
 endif

+# Check that MPI include path exists.
+ifeq ("$(wildcard $(MPI_INCLUDE_ROOT))","")
+$(error Could not find MPI in "$(MPI_INCLUDE_ROOT)")
+endif
+
 # Check that CUDA path exists.
 ifeq ("$(wildcard $(CUDA_ROOT))","")
 $(error Could not find CUDA in "$(CUDA_ROOT)")
@@ -11,7 +16,7 @@
 CC:=mpic++
 NVCC:=nvcc
 LDFLAGS:=-L$(CUDA_ROOT)/lib64 -L$(MPI_ROOT)/lib -lcudart -lmpi -DOMPI_SKIP_MPICXX=
-CFLAGS:=-std=c++11 -I$(MPI_ROOT)/include -I. -I$(CUDA_ROOT)/include -DOMPI_SKIP_MPICXX=
+CFLAGS:=-std=c++11 -I$(MPI_INCLUDE_ROOT) -I$(MPI_ROOT)/include -I. -I$(CUDA_ROOT)/include -DOMPI_SKIP_MPICXX=
 EXE_NAME:=allreduce-test
 SRC:=$(wildcard *.cpp test/*.cpp)
 CU_SRC:=$(wildcard *.cu)