separate MAX_WORKERS and MAX_THREADS (obs from Paulo Moura)
MAX_AGENTS can be used in all cases git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2189 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
7aab33a153
commit
70b3438293
8
C/init.c
8
C/init.c
@ -83,9 +83,9 @@ ADDR Yap_HeapBase;
|
||||
|
||||
#if defined(THREADS)
|
||||
|
||||
struct restore_info rinfo[MAX_WORKERS];
|
||||
struct restore_info rinfo[MAX_THREADS];
|
||||
|
||||
struct thread_globs Yap_thread_gl[MAX_WORKERS];
|
||||
struct thread_globs Yap_thread_gl[MAX_THREADS];
|
||||
|
||||
#else
|
||||
|
||||
@ -968,7 +968,7 @@ InitCodes(void)
|
||||
INIT_LOCK(Yap_heap_regs->thread_handles_lock);
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < MAX_WORKERS; i++) {
|
||||
for (i=0; i < MAX_THREADS; i++) {
|
||||
Yap_heap_regs->thread_handle[i].in_use = FALSE;
|
||||
Yap_heap_regs->thread_handle[i].zombie = FALSE;
|
||||
Yap_heap_regs->thread_handle[i].local_preds = NULL;
|
||||
@ -1001,7 +1001,7 @@ InitCodes(void)
|
||||
Yap_heap_regs->heap_top_owner = -1;
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < MAX_WORKERS; i++) {
|
||||
for (i=0; i < MAX_AGENTS; i++) {
|
||||
INIT_LOCK(Yap_heap_regs->wl[i].signal_lock);
|
||||
Yap_heap_regs->wl[i].active_signals = 0;
|
||||
Yap_heap_regs->wl[i].scratchpad.ptr = NULL;
|
||||
|
10
C/threads.c
10
C/threads.c
@ -43,11 +43,11 @@ allocate_new_tid(void)
|
||||
{
|
||||
int new_worker_id = 0;
|
||||
LOCK(ThreadHandlesLock);
|
||||
while(new_worker_id < MAX_WORKERS &&
|
||||
while(new_worker_id < MAX_THREADS &&
|
||||
(ThreadHandle[new_worker_id].in_use == TRUE ||
|
||||
ThreadHandle[new_worker_id].zombie == TRUE) )
|
||||
new_worker_id++;
|
||||
if (new_worker_id < MAX_WORKERS) {
|
||||
if (new_worker_id < MAX_THREADS) {
|
||||
pthread_mutex_lock(&(ThreadHandle[new_worker_id].tlock));
|
||||
ThreadHandle[new_worker_id].in_use = TRUE;
|
||||
} else {
|
||||
@ -184,7 +184,7 @@ p_thread_new_tid(void)
|
||||
{
|
||||
int new_worker = allocate_new_tid();
|
||||
if (new_worker == -1) {
|
||||
Yap_Error(RESOURCE_ERROR_MAX_THREADS, MkIntegerTerm(MAX_WORKERS), "");
|
||||
Yap_Error(RESOURCE_ERROR_MAX_THREADS, MkIntegerTerm(MAX_THREADS), "");
|
||||
return FALSE;
|
||||
}
|
||||
return Yap_unify(MkIntegerTerm(new_worker), ARG1);
|
||||
@ -617,7 +617,7 @@ p_nof_threads(void)
|
||||
{ /* '$nof_threads'(+P) */
|
||||
int i = 0, wid;
|
||||
LOCK(ThreadHandlesLock);
|
||||
for (wid = 0; wid < MAX_WORKERS; wid++) {
|
||||
for (wid = 0; wid < MAX_THREADS; wid++) {
|
||||
if (ThreadHandle[wid].in_use)
|
||||
i++;
|
||||
}
|
||||
@ -628,7 +628,7 @@ p_nof_threads(void)
|
||||
static Int
|
||||
p_max_threads(void)
|
||||
{ /* '$max_threads'(+P) */
|
||||
return Yap_unify(ARG1,MkIntegerTerm(MAX_WORKERS));
|
||||
return Yap_unify(ARG1,MkIntegerTerm(MAX_THREADS));
|
||||
}
|
||||
|
||||
static Int
|
||||
|
8
H/Heap.h
8
H/Heap.h
@ -10,7 +10,7 @@
|
||||
* File: Heap.h *
|
||||
* mods: *
|
||||
* comments: Heap Init Structure *
|
||||
* version: $Id: Heap.h,v 1.128 2008-04-01 22:28:41 vsc Exp $ *
|
||||
* version: $Id: Heap.h,v 1.129 2008-04-02 15:41:50 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
/* information that can be stored in Code Space */
|
||||
@ -98,7 +98,7 @@ typedef struct restore_info {
|
||||
} restoreinfo;
|
||||
|
||||
#if defined(THREADS)
|
||||
extern struct restore_info rinfo[MAX_WORKERS];
|
||||
extern struct restore_info rinfo[MAX_THREADS];
|
||||
#else
|
||||
extern struct restore_info rinfo;
|
||||
#endif
|
||||
@ -224,7 +224,7 @@ typedef struct various_codes {
|
||||
#if defined(YAPOR) || defined(THREADS)
|
||||
lockvar bgl; /* protect long critical regions */
|
||||
lockvar free_blocks_lock; /* protect the list of free blocks */
|
||||
worker_local wl[MAX_WORKERS];
|
||||
worker_local wl[MAX_AGENTS];
|
||||
#else
|
||||
worker_local wl;
|
||||
#endif
|
||||
@ -564,7 +564,7 @@ typedef struct various_codes {
|
||||
#endif /* YAPOR || TABLING */
|
||||
#ifdef THREADS
|
||||
lockvar thread_handles_lock; /* protect ThreadManipulation */
|
||||
struct thandle thread_handle[MAX_WORKERS];
|
||||
struct thandle thread_handle[MAX_THREADS];
|
||||
#endif
|
||||
UInt n_of_atoms;
|
||||
UInt atom_hash_table_size;
|
||||
|
10
H/Yap.h
10
H/Yap.h
@ -10,7 +10,7 @@
|
||||
* File: Yap.h.m4 *
|
||||
* mods: *
|
||||
* comments: main header file for YAP *
|
||||
* version: $Id: Yap.h,v 1.31 2008-03-27 00:41:32 vsc Exp $ *
|
||||
* version: $Id: Yap.h,v 1.32 2008-04-02 15:41:50 vsc Exp $ *
|
||||
*************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
@ -388,6 +388,12 @@ typedef pthread_rwlock_t rwlock_t;
|
||||
#ifdef __alpha
|
||||
#include <alpha_locks_funcs.h>
|
||||
#endif
|
||||
#ifdef YAPOR
|
||||
#define MAX_AGENTS MAX_WORKERS
|
||||
#endif
|
||||
#ifdef THREADS
|
||||
#define MAX_AGENTS MAX_THREADS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/************ variables concerned with Error Handling *************/
|
||||
@ -730,7 +736,7 @@ typedef struct thread_globs
|
||||
|
||||
} tglobs;
|
||||
|
||||
extern struct thread_globs Yap_thread_gl[MAX_WORKERS];
|
||||
extern struct thread_globs Yap_thread_gl[MAX_THREADS];
|
||||
|
||||
|
||||
#define Yap_LocalBase Yap_thread_gl[worker_id].local_base
|
||||
|
@ -301,3 +301,7 @@
|
||||
|
||||
#undef MAX_WORKERS
|
||||
|
||||
#undef MAX_THREADS
|
||||
|
||||
|
||||
|
||||
|
22
configure.in
22
configure.in
@ -240,7 +240,7 @@ AC_ARG_WITH(trail-space,
|
||||
[yap_cv_trail_space=0])
|
||||
|
||||
AC_ARG_WITH(max-workers,
|
||||
[ --with-max-workers[=integer] maximum number of threads or parallel processes],
|
||||
[ --with-max-workers[=integer] maximum number of or-parallel processes],
|
||||
if test "$withval" = yes; then
|
||||
yap_cv_max_workers="(8*SIZEOF_INT_P)"
|
||||
elif test "$withval" = no; then
|
||||
@ -250,6 +250,17 @@ AC_ARG_WITH(max-workers,
|
||||
fi,
|
||||
[yap_cv_max_workers="(8*SIZEOF_INT_P)"])
|
||||
|
||||
AC_ARG_WITH(max-threads,
|
||||
[ --with-max-threads[=integer] maximum number of or-parallel processes],
|
||||
if test "$withval" = yes; then
|
||||
yap_cv_max_threads="1024"
|
||||
elif test "$withval" = no; then
|
||||
yap_cv_max_threads="1"
|
||||
else
|
||||
yap_cv_max_threads=$withval
|
||||
fi,
|
||||
[yap_cv_max_threads="1024"])
|
||||
|
||||
|
||||
if test "$tabling" = yes -o "$orparallelism" = yes -o "$threads" = yes
|
||||
then
|
||||
@ -270,13 +281,20 @@ AC_CANONICAL_SYSTEM
|
||||
|
||||
AC_DEFINE_UNQUOTED(HOST_ALIAS,"${target}")
|
||||
|
||||
if test "$or-parallelism" = no -a "$threads" = no
|
||||
if test "$or-parallelism" = no
|
||||
then
|
||||
AC_DEFINE(MAX_WORKERS,1)
|
||||
else
|
||||
eval "AC_DEFINE(MAX_WORKERS,$yap_cv_max_workers)"
|
||||
fi
|
||||
|
||||
if test "$threads" = no
|
||||
then
|
||||
AC_DEFINE(MAX_THREADS,1)
|
||||
else
|
||||
eval "AC_DEFINE(MAX_THREADS,$yap_cv_max_threads)"
|
||||
fi
|
||||
|
||||
|
||||
dnl condor does not like dynamic linking on Linux, DEC, and HP-UX platforms.
|
||||
if test "$yap_cv_matlab" = no
|
||||
|
@ -428,41 +428,41 @@ yap_flag(min_tagged_integer,X) :-
|
||||
|
||||
/* ISO Core Revision DTR: new float flags
|
||||
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
var(X), !,
|
||||
?????
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,float_mantissa_digits),yap_flag(float_mantissa_digits,X)).
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_mantissa_digits+X),yap_flag(float_mantissa_digits,X)).
|
||||
'$do_error'(permission_error(modify,flag,float_mantissa_digits),yap_flag(float_mantissa_digits,X)).
|
||||
yap_flag(float_mantissa_digits,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_mantissa_digits+X),yap_flag(float_mantissa_digits,X)).
|
||||
|
||||
yap_flag(float_epsilon,X) :-
|
||||
yap_flag(float_epsilon,X) :-
|
||||
var(X), !,
|
||||
?????
|
||||
yap_flag(float_epsilon,X) :-
|
||||
yap_flag(float_epsilon,X) :-
|
||||
float(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,float_epsilon),yap_flag(float_epsilon,X)).
|
||||
yap_flag(float_epsilon,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_epsilon+X),yap_flag(float_epsilon,X)).
|
||||
'$do_error'(permission_error(modify,flag,float_epsilon),yap_flag(float_epsilon,X)).
|
||||
yap_flag(float_epsilon,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_epsilon+X),yap_flag(float_epsilon,X)).
|
||||
|
||||
yap_flag(float_min_exponent,X) :-
|
||||
yap_flag(float_min_exponent,X) :-
|
||||
var(X), !,
|
||||
?????
|
||||
yap_flag(float_min_exponent,X) :-
|
||||
yap_flag(float_min_exponent,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,float_min_exponent),yap_flag(float_min_exponent,X)).
|
||||
yap_flag(float_epsilon,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_min_exponent+X),yap_flag(float_min_exponent,X)).
|
||||
'$do_error'(permission_error(modify,flag,float_min_exponent),yap_flag(float_min_exponent,X)).
|
||||
yap_flag(float_epsilon,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_min_exponent+X),yap_flag(float_min_exponent,X)).
|
||||
|
||||
yap_flag(float_max_exponent,X) :-
|
||||
var(X), !,
|
||||
?????
|
||||
yap_flag(float_max_exponent,X) :-
|
||||
integer(X), X > 0, !,
|
||||
'$do_error'(permission_error(modify,flag,float_max_exponent),yap_flag(float_max_exponent,X)).
|
||||
'$do_error'(permission_error(modify,flag,float_max_exponent),yap_flag(float_max_exponent,X)).
|
||||
yap_flag(float_max_exponent,X) :-
|
||||
'$do_error'(domain_error(flag_value,float_max_exponent+X),yap_flag(float_max_exponent,X)).
|
||||
'$do_error'(domain_error(flag_value,float_max_exponent+X),yap_flag(float_max_exponent,X)).
|
||||
*/
|
||||
|
||||
yap_flag(char_conversion,X) :-
|
||||
|
Reference in New Issue
Block a user