diff --git a/src/cuda/DeviceSelectMPI.cpp b/src/cuda/DeviceSelectMPI.cpp
index 4fdab2f924630cff50d9fbd3091f8e193f45fe87..d934abe797175a89ee5006a305755ccd2de25270 100644
--- a/src/cuda/DeviceSelectMPI.cpp
+++ b/src/cuda/DeviceSelectMPI.cpp
@@ -27,7 +27,15 @@
 namespace walberla {
 namespace cuda {
 
-#ifdef WALBERLA_BUILD_WITH_MPI
+#if MPI_VERSION == 2 || MPI_VERSION == 1
+
+#ifndef MPI_COMM_TYPE_SHARED
+
+void selectDeviceBasedOnMpiRank() {
+   WALBERLA_ABORT("Your MPI implementation is tool old - it does not support CUDA device selection based on MPI rank");
+}
+
+#else
 
 void selectDeviceBasedOnMpiRank()
 {
@@ -62,6 +70,8 @@ void selectDeviceBasedOnMpiRank()
       WALBERLA_CUDA_CHECK( cudaSetDevice( rankOnNode % deviceCount ) );
    }
 }
+#endif
+
 
 #else