--- a/common/autoconf/build-performance.m4 Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/build-performance.m4 Mon Mar 04 16:45:07 2013 +0100
@@ -47,10 +47,6 @@
FOUND_CORES=yes
fi
- # For c/c++ code we run twice as many concurrent build
- # jobs than we have cores, otherwise we will stall on io.
- CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
-
if test "x$FOUND_CORES" = xyes; then
AC_MSG_RESULT([$NUM_CORES])
else
@@ -98,32 +94,62 @@
AC_DEFUN_ONCE([BPERF_SETUP_BUILD_CORES],
[
-# How many cores do we have on this build system?
-AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
+ # How many cores do we have on this build system?
+ AC_ARG_WITH(num-cores, [AS_HELP_STRING([--with-num-cores],
[number of cores in the build system, e.g. --with-num-cores=8 @<:@probed@:>@])])
-if test "x$with_num_cores" = x; then
+ if test "x$with_num_cores" = x; then
# The number of cores were not specified, try to probe them.
BPERF_CHECK_CORES
-else
+ else
NUM_CORES=$with_num_cores
- CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
-fi
-AC_SUBST(NUM_CORES)
-AC_SUBST(CONCURRENT_BUILD_JOBS)
+ fi
+ AC_SUBST(NUM_CORES)
])
AC_DEFUN_ONCE([BPERF_SETUP_BUILD_MEMORY],
[
-# How much memory do we have on this build system?
-AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
+ # How much memory do we have on this build system?
+ AC_ARG_WITH(memory-size, [AS_HELP_STRING([--with-memory-size],
[memory (in MB) available in the build system, e.g. --with-memory-size=1024 @<:@probed@:>@])])
-if test "x$with_memory_size" = x; then
+ if test "x$with_memory_size" = x; then
# The memory size was not specified, try to probe it.
BPERF_CHECK_MEMORY_SIZE
-else
+ else
MEMORY_SIZE=$with_memory_size
-fi
-AC_SUBST(MEMORY_SIZE)
+ fi
+ AC_SUBST(MEMORY_SIZE)
+])
+
+AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
+[
+ # Provide a decent default number of parallel jobs for make depending on
+ # number of cores, amount of memory and machine architecture.
+ AC_ARG_WITH(jobs, [AS_HELP_STRING([--with-jobs],
+ [number of parallel jobs to let make run @<:@calculated based on cores and memory@:>@])])
+ if test "x$with_jobs" = x; then
+ # Number of jobs was not specified, calculate.
+ AC_MSG_CHECKING([for appropriate number of jobs to run in parallel])
+ # Approximate memory in GB, rounding up a bit.
+ memory_gb=`expr $MEMORY_SIZE / 1100`
+ # Pick the lowest of memory in gb and number of cores.
+ if test "$memory_gb" -lt "$NUM_CORES"; then
+ JOBS="$memory_gb"
+ else
+ JOBS="$NUM_CORES"
+ # On bigger machines, leave some room for other processes to run
+ if test "$JOBS" -gt "4"; then
+ JOBS=`expr $JOBS '*' 90 / 100`
+ fi
+ fi
+ # Cap number of jobs to 16
+ if test "$JOBS" -gt "16"; then
+ JOBS=16
+ fi
+ AC_MSG_RESULT([$JOBS])
+ else
+ JOBS=$with_jobs
+ fi
+ AC_SUBST(JOBS)
])
AC_DEFUN([BPERF_SETUP_CCACHE],
--- a/common/autoconf/configure.ac Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/configure.ac Mon Mar 04 16:45:07 2013 +0100
@@ -204,6 +204,7 @@
BPERF_SETUP_BUILD_CORES
BPERF_SETUP_BUILD_MEMORY
+BPERF_SETUP_BUILD_JOBS
# Setup smart javac (after cores and memory have been setup)
BPERF_SETUP_SMART_JAVAC
--- a/common/autoconf/generated-configure.sh Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/generated-configure.sh Mon Mar 04 16:45:07 2013 +0100
@@ -601,8 +601,8 @@
ENABLE_SJAVAC
SJAVAC_SERVER_CORES
SJAVAC_SERVER_JAVA
+JOBS
MEMORY_SIZE
-CONCURRENT_BUILD_JOBS
NUM_CORES
SALIB_NAME
HOTSPOT_MAKE_ARGS
@@ -1002,6 +1002,7 @@
with_stdc__lib
with_num_cores
with_memory_size
+with_jobs
with_sjavac_server_java
with_sjavac_server_cores
enable_sjavac
@@ -1760,6 +1761,8 @@
--with-num-cores=8 [probed]
--with-memory-size memory (in MB) available in the build system, e.g.
--with-memory-size=1024 [probed]
+ --with-jobs number of parallel jobs to let make run [calculated
+ based on cores and memory]
--with-sjavac-server-java
use this java binary for running the sjavac
background server [Boot JDK java]
@@ -3329,6 +3332,8 @@
+
+
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3724,7 +3729,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1361452590
+DATE_WHEN_GENERATED=1362411827
###############################################################################
#
@@ -31225,14 +31230,14 @@
###############################################################################
-# How many cores do we have on this build system?
+ # How many cores do we have on this build system?
# Check whether --with-num-cores was given.
if test "${with_num_cores+set}" = set; then :
withval=$with_num_cores;
fi
-if test "x$with_num_cores" = x; then
+ if test "x$with_num_cores" = x; then
# The number of cores were not specified, try to probe them.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for number of cores" >&5
@@ -31258,10 +31263,6 @@
FOUND_CORES=yes
fi
- # For c/c++ code we run twice as many concurrent build
- # jobs than we have cores, otherwise we will stall on io.
- CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
-
if test "x$FOUND_CORES" = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $NUM_CORES" >&5
$as_echo "$NUM_CORES" >&6; }
@@ -31273,22 +31274,20 @@
fi
-else
+ else
NUM_CORES=$with_num_cores
- CONCURRENT_BUILD_JOBS=`expr $NUM_CORES \* 2`
-fi
-
-
-
-
-# How much memory do we have on this build system?
+ fi
+
+
+
+ # How much memory do we have on this build system?
# Check whether --with-memory-size was given.
if test "${with_memory_size+set}" = set; then :
withval=$with_memory_size;
fi
-if test "x$with_memory_size" = x; then
+ if test "x$with_memory_size" = x; then
# The memory size was not specified, try to probe it.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for memory size" >&5
@@ -31328,9 +31327,45 @@
$as_echo "$as_me: WARNING: This might seriously impact build performance!" >&2;}
fi
-else
+ else
MEMORY_SIZE=$with_memory_size
-fi
+ fi
+
+
+
+ # Provide a decent default number of parallel jobs for make depending on
+ # number of cores, amount of memory and machine architecture.
+
+# Check whether --with-jobs was given.
+if test "${with_jobs+set}" = set; then :
+ withval=$with_jobs;
+fi
+
+ if test "x$with_jobs" = x; then
+ # Number of jobs was not specified, calculate.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for appropriate number of jobs to run in parallel" >&5
+$as_echo_n "checking for appropriate number of jobs to run in parallel... " >&6; }
+ # Approximate memory in GB, rounding up a bit.
+ memory_gb=`expr $MEMORY_SIZE / 1100`
+ # Pick the lowest of memory in gb and number of cores.
+ if test "$memory_gb" -lt "$NUM_CORES"; then
+ JOBS="$memory_gb"
+ else
+ JOBS="$NUM_CORES"
+ # On bigger machines, leave some room for other processes to run
+ if test "$JOBS" -gt "4"; then
+ JOBS=`expr $JOBS '*' 90 / 100`
+ fi
+ fi
+ # Cap number of jobs to 16
+ if test "$JOBS" -gt "16"; then
+ JOBS=16
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JOBS" >&5
+$as_echo "$JOBS" >&6; }
+ else
+ JOBS=$with_jobs
+ fi
@@ -33143,7 +33178,7 @@
printf "\n"
printf "Build performance summary:\n"
-printf "* Cores to use: $NUM_CORES\n"
+printf "* Cores to use: $JOBS\n"
printf "* Memory limit: $MEMORY_SIZE MB\n"
printf "* ccache status: $CCACHE_STATUS\n"
printf "\n"
--- a/common/autoconf/help.m4 Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/help.m4 Mon Mar 04 16:45:07 2013 +0100
@@ -174,7 +174,7 @@
printf "\n"
printf "Build performance summary:\n"
-printf "* Cores to use: $NUM_CORES\n"
+printf "* Cores to use: $JOBS\n"
printf "* Memory limit: $MEMORY_SIZE MB\n"
printf "* ccache status: $CCACHE_STATUS\n"
printf "\n"
--- a/common/autoconf/hotspot-spec.gmk.in Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/hotspot-spec.gmk.in Mon Mar 04 16:45:07 2013 +0100
@@ -80,7 +80,7 @@
HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@ @STATIC_CXX_SETTING@
# This is used from the libjvm build for C/C++ code.
-HOTSPOT_BUILD_JOBS:=@CONCURRENT_BUILD_JOBS@
+HOTSPOT_BUILD_JOBS:=$(JOBS)
# Control wether Hotspot runs Queens test after building
TEST_IN_BUILD=@TEST_IN_BUILD@
--- a/common/autoconf/spec.gmk.in Thu Feb 28 20:29:19 2013 -0800
+++ b/common/autoconf/spec.gmk.in Mon Mar 04 16:45:07 2013 +0100
@@ -260,6 +260,9 @@
# the sjavac server log files.
SJAVAC_SERVER_DIR:=@SJAVAC_SERVER_DIR@
+# Number of parallel jobs to use for compilation
+JOBS?=@JOBS@
+
# The OpenJDK makefiles should be changed to using the standard
# configure output ..._CFLAGS and ..._LIBS. In the meantime we
# extract the information here.
--- a/common/makefiles/JavaCompilation.gmk Thu Feb 28 20:29:19 2013 -0800
+++ b/common/makefiles/JavaCompilation.gmk Mon Mar 04 16:45:07 2013 +0100
@@ -501,7 +501,7 @@
$(ECHO) Compiling $1
($$($1_JVM) $$($1_SJAVAC) \
$$($1_REMOTE) \
- -j $(NUM_CORES) \
+ -j $(JOBS) \
--permit-unidentified-artifacts \
--permit-sources-without-package \
--compare-found-sources $$($1_BIN)/_the.batch.tmp \
--- a/common/makefiles/Main.gmk Thu Feb 28 20:29:19 2013 -0800
+++ b/common/makefiles/Main.gmk Mon Mar 04 16:45:07 2013 +0100
@@ -58,9 +58,6 @@
# Setup number of jobs to use. -jN is unfortunately not available for us to parse from the command line,
# hence this workaround.
-ifeq ($(JOBS),)
- JOBS=$(NUM_CORES)
-endif
MAKE_ARGS:=$(MAKE_ARGS) -j$(JOBS)
### Main targets