You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2017/07/19 00:21:12 UTC

[2/2] mesos git commit: Introduced moodycamel/concurrentqueue as a 3rdparty library.

Introduced moodycamel/concurrentqueue as a 3rdparty library.

This is a header only library that provides a lock-free concurrent
queue which we can leverage in libprocess to improve performance.

The update to the CMake build will be added separately from this
change, note that this does not break the CMake build, since it
is not used yet. The plan is to have inclusion of concurrentqueue.h
be guarded by a configure flag to begin with, which means that it
will not break the CMake build, it will however prevent CMake
users from choosing to use the concurrent queue until the CMake
integration is complete.

Review: https://reviews.apache.org/r/60952


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2096c044
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2096c044
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2096c044

Branch: refs/heads/master
Commit: 2096c044f1cfcb26ca554eaa37df9f20f5345c98
Parents: 916a5c9
Author: Benjamin Mahler <bm...@apache.org>
Authored: Tue Jul 18 16:59:35 2017 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Jul 18 17:20:51 2017 -0700

----------------------------------------------------------------------
 3rdparty/Makefile.am                       |  76 ++++++++++++++----------
 3rdparty/concurrentqueue-1.0.0-beta.tar.gz | Bin 0 -> 1369950 bytes
 3rdparty/versions.am                       |   1 +
 configure.ac                               |  41 +++++++++++++
 docs/configuration.md                      |   9 +++
 src/Makefile.am                            |   8 +++
 support/coverage.sh                        |   1 +
 7 files changed, 106 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/3rdparty/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/Makefile.am b/3rdparty/Makefile.am
index 21dba15..ce32885 100644
--- a/3rdparty/Makefile.am
+++ b/3rdparty/Makefile.am
@@ -43,6 +43,7 @@ pkg3rdpartydir = $(pkglibdir)/3rdparty
 include versions.am
 
 BOOST = boost-$(BOOST_VERSION)
+CONCURRENTQUEUE = concurrentqueue-$(CONCURRENTQUEUE_VERSION)
 ELFIO = elfio-$(ELFIO_VERSION)
 GLOG = glog-$(GLOG_VERSION)
 GOOGLETEST = googletest-release-$(GOOGLETEST_VERSION)
@@ -60,21 +61,22 @@ SETUPTOOLS = setuptools-$(SETUPTOOLS_VERSION)
 WHEEL = wheel-$(WHEEL_VERSION)
 ZOOKEEPER = zookeeper-$(ZOOKEEPER_VERSION)
 
-EXTRA_DIST =		\
-  $(BOOST).tar.gz	\
-  $(ELFIO).tar.gz	\
-  $(GLOG).tar.gz	\
-  $(GOOGLETEST).tar.gz	\
-  $(GPERFTOOLS).tar.gz	\
-  $(HTTP_PARSER).tar.gz	\
-  $(LEVELDB).tar.gz	\
-  $(LIBEV).tar.gz	\
-  $(NVML).tar.gz	\
-  $(PIP).tar.gz		\
-  $(PROTOBUF).tar.gz	\
-  $(PICOJSON).tar.gz	\
-  $(SETUPTOOLS).tar.gz	\
-  $(WHEEL).tar.gz	\
+EXTRA_DIST =			\
+  $(BOOST).tar.gz		\
+  $(CONCURRENTQUEUE).tar.gz	\
+  $(ELFIO).tar.gz		\
+  $(GLOG).tar.gz		\
+  $(GOOGLETEST).tar.gz		\
+  $(GPERFTOOLS).tar.gz		\
+  $(HTTP_PARSER).tar.gz		\
+  $(LEVELDB).tar.gz		\
+  $(LIBEV).tar.gz		\
+  $(NVML).tar.gz		\
+  $(PIP).tar.gz			\
+  $(PROTOBUF).tar.gz		\
+  $(PICOJSON).tar.gz		\
+  $(SETUPTOOLS).tar.gz		\
+  $(WHEEL).tar.gz		\
   $(ZOOKEEPER).tar.gz
 
 # We need to patch glog in order to deal with a compilation issue when
@@ -95,21 +97,22 @@ EXTRA_DIST +=		\
 EXTRA_DIST +=		\
   $(ZOOKEEPER).patch
 
-CLEAN_EXTRACTED =	\
-  $(BOOST)		\
-  $(ELFIO)		\
-  $(GLOG)		\
-  $(GOOGLETEST)		\
-  $(GPERFTOOLS)		\
-  $(HTTP_PARSER)	\
-  $(LEVELDB)		\
-  $(LIBEV)		\
-  $(NVML)		\
-  $(PIP)		\
-  $(PICOJSON)		\
-  $(PROTOBUF)		\
-  $(SETUPTOOLS)		\
-  $(WHEEL)		\
+CLEAN_EXTRACTED =		\
+  $(BOOST)			\
+  $(CONCURRENTQUEUE)		\
+  $(ELFIO)			\
+  $(GLOG)			\
+  $(GOOGLETEST)			\
+  $(GPERFTOOLS)			\
+  $(HTTP_PARSER)		\
+  $(LEVELDB)			\
+  $(LIBEV)			\
+  $(NVML)			\
+  $(PIP)			\
+  $(PICOJSON)			\
+  $(PROTOBUF)			\
+  $(SETUPTOOLS)			\
+  $(WHEEL)			\
   $(ZOOKEEPER)
 
 # This is where the magic happens: we use stamp files as dependencies
@@ -141,6 +144,14 @@ if WITH_BUNDLED_BOOST
   ALL_LOCAL += $(BOOST)-stamp
 endif
 
+if WITH_BUNDLED_CONCURRENTQUEUE
+# Libprocess depends on <concurrentqueue.h>. Install concurrentqeueue.h
+# into $PREFIX/include but don't add it to the source tarball.
+nodist_include_HEADERS = $(CONCURRENTQUEUE)/concurrentqueue.h
+$(CONCURRENTQUEUE)/concurrentqueue.h: $(CONCURRENTQUEUE)-stamp
+ALL_LOCAL += $(CONCURRENTQUEUE)-stamp
+endif
+
 if WITH_BUNDLED_ELFIO
 # Stout depends on ELFIO. Install ELFIO into $PREFIX/include
 # but don't add it to the source tarball.
@@ -338,6 +349,11 @@ if WITH_BUNDLED_BOOST
 	  rm -rf $(INSTALLDIR)/include/boost
 	cp -fpR $(BOOST)/boost $(INSTALLDIR)/include/
 endif
+if WITH_BUNDLED_CONCURRENTQUEUE
+	@test -d $(INSTALLDIR)/include/concurrentqueue || \
+	  rm -rf $(INSTALLDIR)/include/concurrentqueue
+	cp -fpR $(CONCURRENTQUEUE)/concurrentqueue.h $(INSTALLDIR)/include/
+endif
 if WITH_BUNDLED_ELFIO
 	@test -d $(INSTALLDIR)/include/elfio || \
 	  rm -rf $(INSTALLDIR)/include/elfio

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/3rdparty/concurrentqueue-1.0.0-beta.tar.gz
----------------------------------------------------------------------
diff --git a/3rdparty/concurrentqueue-1.0.0-beta.tar.gz b/3rdparty/concurrentqueue-1.0.0-beta.tar.gz
new file mode 100644
index 0000000..1bf4a88
Binary files /dev/null and b/3rdparty/concurrentqueue-1.0.0-beta.tar.gz differ

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/3rdparty/versions.am
----------------------------------------------------------------------
diff --git a/3rdparty/versions.am b/3rdparty/versions.am
index f46362c..0893572 100644
--- a/3rdparty/versions.am
+++ b/3rdparty/versions.am
@@ -20,6 +20,7 @@
 # still need to update version numbers in src/python/setup.py.in too!
 
 BOOST_VERSION = 1.53.0
+CONCURRENTQUEUE_VERSION = 1.0.0-beta
 ELFIO_VERSION = 3.2
 GLOG_VERSION = 0.3.3
 GOOGLETEST_VERSION = 1.8.0

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 4d7c4a4..5f2ef52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -282,6 +282,13 @@ AC_ARG_WITH([boost],
                            location prefixed by the given path]),
             [without_bundled_boost=yes], [])
 
+AC_ARG_WITH([concurrentqueue],
+            AS_HELP_STRING([--with-concurrentqueue@<:@=DIR@:>@],
+                           [excludes building and using the bundled concurrentqueue
+                           package in lieu of an installed version at a
+                           location prefixed by the given path]),
+            [without_bundled_concurrentqueue=yes], [])
+
 AC_ARG_WITH([curl],
             AS_HELP_STRING([--with-curl=@<:@=DIR@:>@],
                            [specify where to locate the curl library]),
@@ -773,6 +780,40 @@ fi
 
 AM_CONDITIONAL([WITH_BUNDLED_BOOST], [test "x$with_bundled_boost" = "xyes"])
 
+if test -n "`echo $with_concurrentqueue`"; then
+  CPPFLAGS="-isystem ${with_concurrentqueue} $CPPFLAGS"
+fi
+
+
+# Check if user has asked us to use a preinstalled concurrentqueue,
+# or if they asked us to ignore all bundled libraries while compiling
+# and linking.
+if test "x$without_bundled_concurrentqueue" = "xyes" || \
+   test "x$enable_bundled" != "xyes"; then
+  # Check if headers and library were located.
+  AC_CHECK_HEADERS([concurrentqueue.h], [found_concurrentqueue=yes])
+
+  if test "x$found_concurrentqueue" = "xyes"; then
+    with_bundled_concurrentqueue=no
+  else
+    AC_MSG_ERROR([cannot find concurrentqueue
+-------------------------------------------------------------------
+You have requested the use of a non-bundled concurrentqueue but no
+suitable concurrentqueue could be found.
+
+You may want specify the location of concurrentqueue by providing a
+prefix path via --with-concurrentqueue=DIR, or check that the path
+you provided is correct if you're already doing this.
+-------------------------------------------------------------------
+])
+  fi
+else
+  with_bundled_concurrentqueue=yes
+fi
+
+AM_CONDITIONAL([WITH_BUNDLED_CONCURRENTQUEUE],
+               [test "x$with_bundled_concurrentqueue" = "xyes"])
+
 
 # Check if Libcurl prefix path was provided, and if so, add it to
 # the CPPFLAGS and LDFLAGS with respective /include and /lib path

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index f39d220..a06ac82 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -2553,6 +2553,15 @@ quotas for container sandbox directories. Valid project IDs range from
   </tr>
   <tr>
     <td>
+      --with-concurrentqueue[=DIR]
+    </td>
+    <td>
+      Excludes building and using the bundled concurrentqueue package in lieu
+      of an installed version at a location prefixed by the given path.
+    </td>
+  </tr>
+  <tr>
+    <td>
       --with-curl=[=DIR]
     </td>
     <td>

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index b1d7ca1..8b91716 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,7 @@ ZOOKEEPER_JAR = 3rdparty/zookeeper-$(ZOOKEEPER_VERSION)/zookeeper-$(ZOOKEEPER_VE
 LIBPROCESS = 3rdparty/libprocess
 STOUT = 3rdparty/stout
 BOOST = 3rdparty/boost-$(BOOST_VERSION)
+CONCURRENTQUEUE = 3rdparty/concurrentqueue-$(CONCURRENTQUEUE_VERSION)
 ELFIO = 3rdparty/elfio-$(ELFIO_VERSION)
 GLOG = 3rdparty/glog-$(GLOG_VERSION)
 GOOGLETEST = 3rdparty/googletest-release-$(GOOGLETEST_VERSION)
@@ -153,6 +154,13 @@ if WITH_BUNDLED_BOOST
 MESOS_CPPFLAGS += -isystem ../$(BOOST)
 endif
 
+if WITH_BUNDLED_CONCURRENTQUEUE
+# We use "-isystem" instead of "-I" to add concurrentqueue to the include
+# search path. This disables compiler warnings inside concurrentqueue
+# headers since we don't own the library.
+MESOS_CPPFLAGS += -isystem ../$(CONCURRENTQUEUE)
+endif
+
 if WITH_BUNDLED_ELFIO
 MESOS_CPPFLAGS += -I../$(ELFIO)
 endif

http://git-wip-us.apache.org/repos/asf/mesos/blob/2096c044/support/coverage.sh
----------------------------------------------------------------------
diff --git a/support/coverage.sh b/support/coverage.sh
index 4879b3f..95d6b8e 100755
--- a/support/coverage.sh
+++ b/support/coverage.sh
@@ -38,6 +38,7 @@ lcov --directory . -c -o mesos_test.info
 LCOV_FILTERS="/usr/include/*"
 LCOV_FILTERS+=" /usr/lib/jvm/*"
 LCOV_FILTERS+=" mesos/build/*"
+LCOV_FILTERS+=" build/3rdparty/concurrentqueue*"
 LCOV_FILTERS+=" build/3rdparty/setuptools-*"
 LCOV_FILTERS+=" build/3rdparty/leveldb*"
 LCOV_FILTERS+=" build/3rdparty/zookeeper-*"