[prev in list] [next in list] [prev in thread] [next in thread]
List: sbcl-commits
Subject: [Sbcl-commits] master: Reduce sb-concurrency tests based on the number of CPUs.
From: stassats via Sbcl-commits <sbcl-commits () lists ! sourceforge ! net>
Date: 2017-11-23 23:42:58
Message-ID: 1511480578.613003.16579 () sfp-scm-6 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]
The branch "master" has been updated in SBCL:
via d142fb67350ba157812c37f347b25853b8be10b1 (commit)
from d80c1cfe6e77519dcb2b2421a82c9b3685da013c (commit)
- Log -----------------------------------------------------------------
commit d142fb67350ba157812c37f347b25853b8be10b1
Author: Stas Boukarev <stassats@gmail.com>
Date: Fri Nov 24 02:38:12 2017 +0300
Reduce sb-concurrency tests based on the number of CPUs.
---
contrib/sb-concurrency/tests/test-frlock.lisp | 3 ++-
contrib/sb-concurrency/tests/test-gate.lisp | 4 ++--
contrib/sb-concurrency/tests/test-mailbox.lisp | 2 +-
contrib/sb-concurrency/tests/test-queue.lisp | 26 +++++++++++++-------------
contrib/sb-concurrency/tests/test-utils.lisp | 8 ++++++++
tools-for-build/grovel-headers.c | 2 ++
6 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/contrib/sb-concurrency/tests/test-frlock.lisp \
b/contrib/sb-concurrency/tests/test-frlock.lisp index 438fdde..d96546c 100644
--- a/contrib/sb-concurrency/tests/test-frlock.lisp
+++ b/contrib/sb-concurrency/tests/test-frlock.lisp
@@ -22,7 +22,8 @@
#+openbsd 0.01
#-openbsd 0.0001)
-(defun test-frlocks (&key (reader-count 100) (read-count 1000000)
+(defun test-frlocks (&key (reader-count (max (* 12 *cpus*) 200))
+ (read-count 1000000)
(outer-read-pause 0) (inner-read-pause 0)
(writer-count 10) (write-count (/ 1 *minimum-sleep*))
(outer-write-pause *minimum-sleep*) (inner-write-pause 0))
diff --git a/contrib/sb-concurrency/tests/test-gate.lisp \
b/contrib/sb-concurrency/tests/test-gate.lisp index 64aa864..5c78884 100644
--- a/contrib/sb-concurrency/tests/test-gate.lisp
+++ b/contrib/sb-concurrency/tests/test-gate.lisp
@@ -28,7 +28,7 @@
;; cross the gate if it is closed.
(deftest gate.1
(let* ((gate (make-gate))
- (marks (make-array 100 :initial-element nil))
+ (marks (make-array (if (> *cpus* 1) 100 50) :initial-element nil))
(threads (loop for i from 0 below (length marks)
collect (make-thread (lambda (n)
(wait-on-gate gate)
@@ -56,7 +56,7 @@
(deftest gate.2
(let* ((gate (make-gate))
(cont (make-gate))
- (marks (make-array 100 :initial-element nil))
+ (marks (make-array (if (> *cpus* 1) 100 50) :initial-element nil))
(threads (loop for i from 0 below (length marks)
collect (make-thread (lambda (n)
(wait-on-gate gate)
diff --git a/contrib/sb-concurrency/tests/test-mailbox.lisp \
b/contrib/sb-concurrency/tests/test-mailbox.lisp index e6fcefe..a2944c9 100644
--- a/contrib/sb-concurrency/tests/test-mailbox.lisp
+++ b/contrib/sb-concurrency/tests/test-mailbox.lisp
@@ -185,7 +185,7 @@
(deftest mailbox.single-producer-multiple-consumers
(test-mailbox-producers-consumers :n-senders 1
- :n-receivers 100
+ :n-receivers (if (> *cpus* 1) 100 50)
:n-messages 1000)
(:received . 1000)
(:garbage . 0)
diff --git a/contrib/sb-concurrency/tests/test-queue.lisp \
b/contrib/sb-concurrency/tests/test-queue.lisp index 98dc395..7ec194e 100644
--- a/contrib/sb-concurrency/tests/test-queue.lisp
+++ b/contrib/sb-concurrency/tests/test-queue.lisp
@@ -151,20 +151,20 @@
(wait-on-semaphore w)
(let ((last -1))
(loop
- (multiple-value-bind (x ok) (dequeue q)
- (cond (x
- (if (and (> x last) ok)
- (setf last x)
- (return (list last x ok))))
- (t
- (if (not ok)
- (return t)
- (return (list last x ok))))))))))
+ (multiple-value-bind (x ok) (dequeue q)
+ (cond (x
+ (if (and (> x last) ok)
+ (setf last x)
+ (return (list last x ok))))
+ (t
+ (if (not ok)
+ (return t)
+ (return (list last x ok))))))))))
(let ((deschedulers
- (list (make-thread #'dq)
- (make-thread #'dq)
- (make-thread #'dq)
- (make-thread #'dq))))
+ (list (make-thread #'dq)
+ (make-thread #'dq)
+ (make-thread #'dq)
+ (make-thread #'dq))))
(loop repeat 4 do (wait-on-semaphore r))
(signal-semaphore w 4)
(mapcar #'join-thread deschedulers))))
diff --git a/contrib/sb-concurrency/tests/test-utils.lisp \
b/contrib/sb-concurrency/tests/test-utils.lisp index a6e4414..5f8fbc9 100644
--- a/contrib/sb-concurrency/tests/test-utils.lisp
+++ b/contrib/sb-concurrency/tests/test-utils.lisp
@@ -14,6 +14,14 @@
#+sb-thread
(progn
+(defvar *cpus*
+ (min 1
+ #-win32 (sb-alien:alien-funcall
+ (sb-alien:extern-alien "sysconf"
+ (function sb-alien:long sb-alien:int))
+ sb-unix::sc-nprocessors-onln)
+ #+win32 (sb-alien:extern-alien "os_number_of_processors" sb-alien:int)))
+
(defparameter +timeout+ 30.0)
(defun make-threads (n name fn)
diff --git a/tools-for-build/grovel-headers.c b/tools-for-build/grovel-headers.c
index 2064921..65ff433 100644
--- a/tools-for-build/grovel-headers.c
+++ b/tools-for-build/grovel-headers.c
@@ -222,6 +222,8 @@ main(int argc, char *argv[])
deferrno("ewouldblock", EWOULDBLOCK);
printf("\n");
+ deferrno("sc-nprocessors-onln", _SC_NPROCESSORS_ONLN);
+
printf(";;; for wait3(2) in run-program.lisp\n");
#ifdef WCONTINUED
defconstant("wcontinued", WCONTINUED);
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sbcl-commits mailing list
Sbcl-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic