new built-in predicates to access OPTYap statistics related to memory

usage.
This commit is contained in:
Ricardo Rocha 2010-04-20 03:59:48 +01:00
parent 1029828775
commit 7eee5a5b56
6 changed files with 1247 additions and 1079 deletions

View File

@ -4155,8 +4155,8 @@ Yap_InitCPreds(void)
Yap_InitCPred("$has_yap_or", 0, p_has_yap_or, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$has_eam", 0, p_has_eam, SafePredFlag|SyncPredFlag|HiddenPredFlag);
#ifndef YAPOR
Yap_InitCPred("$default_sequential", 1, p_default_sequential, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$yapor_threads", 1, p_yapor_threads, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$c_default_sequential", 1, p_default_sequential, SafePredFlag|SyncPredFlag|HiddenPredFlag);
Yap_InitCPred("$c_yapor_threads", 1, p_yapor_threads, SafePredFlag|SyncPredFlag|HiddenPredFlag);
#endif
#ifdef INES
Yap_InitCPred("euc_dist", 3, p_euc_dist, SafePredFlag);
@ -4169,9 +4169,6 @@ Yap_InitCPreds(void)
#ifdef DEBUG
Yap_InitCPred("dump_active_goals", 0, p_dump_active_goals, SafePredFlag|SyncPredFlag);
#endif
#ifndef YAPOR
Yap_InitCPred("$yapor_threads", 1, p_yapor_threads, SafePredFlag|SyncPredFlag);
#endif
Yap_InitArrayPreds();
Yap_InitBBPreds();

File diff suppressed because it is too large Load Diff

View File

@ -121,13 +121,13 @@ true :- true.
nb_setval('$included_file',[]).
'$init_or_threads' :-
'$yapor_threads'(W), !,
'$c_yapor_threads'(W), !,
'$start_orp_threads'(W).
'$init_or_threads'.
'$start_orp_threads'(1) :- !.
'$start_orp_threads'(W) :-
thread_create('$worker',_,[detached(true)]),
thread_create('$c_worker',_,[detached(true)]),
W1 is W-1,
'$start_orp_threads'(W1).
@ -500,9 +500,9 @@ true :- true.
% ***************************
'$query'(G,V) :-
\+ '$undefined'('$yapor_on', prolog),
'$yapor_on',
\+ '$undefined'('$start_yapor', prolog),
\+ '$undefined'('$c_yapor_on', prolog),
'$c_yapor_on',
\+ '$undefined'('$c_start_yapor', prolog),
'$parallelizable'(G), !,
'$parallel_query'(G,V),
fail.

View File

@ -530,7 +530,7 @@ yap_flag(system_options,X) :-
'$system_options'(low_level_tracer) :-
\+ '$undefined'(start_low_level_trace, prolog).
'$system_options'(or_parallelism) :-
\+ '$undefined'('$yapor_on', prolog).
\+ '$undefined'('$c_yapor_on', prolog).
'$system_options'(rational_trees) :-
'$yap_has_rational_trees'.
'$system_options'(readline) :-

View File

@ -1,27 +1,30 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: tabling.yap *
* Last rev: 8/2/88 *
* mods: *
* comments: support tabling predicates *
* *
*************************************************************************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% The YapTab/YapOr/OPTYap systems %%
%% %%
%% YapTab extends the Yap Prolog engine to support sequential tabling %%
%% YapOr extends the Yap Prolog engine to support or-parallelism %%
%% OPTYap extends the Yap Prolog engine to support or-parallel tabling %%
%% %%
%% %%
%% Yap Prolog was developed at University of Porto, Portugal %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- meta_predicate table(:), is_tabled(:), tabling_mode(:), abolish_table(:), show_table(:), table_statistics(:).
:- meta_predicate
table(:),
is_tabled(:),
tabling_mode(:),
abolish_table(:),
show_table(:),
table_statistics(:),
table_statistics(:,:).
/******************
* table/1 *
******************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% table/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
table(Pred) :-
'$current_module'(Mod),
@ -64,9 +67,9 @@ table(Pred) :-
/**********************
* is_tabled/1 *
**********************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% is_tabled/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
is_tabled(Pred) :-
'$current_module'(Mod),
@ -95,9 +98,9 @@ is_tabled(Pred) :-
/*************************
* tabling_mode/2 *
*************************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tabling_mode/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tabling_mode(Pred,Options) :-
'$current_module'(Mod),
@ -123,7 +126,6 @@ tabling_mode(Pred,Options) :-
(
Flags /\ 0x000040 =\= 0, !, '$set_tabling_mode'(Mod,PredFunctor,Options)
;
write(icardioi),nl,
'$do_error'(domain_error(table,Mod:PredName/PredArity),tabling_mode(Mod:PredName/PredArity,Options))
).
'$do_tabling_mode'(Mod,Pred,Options) :-
@ -146,7 +148,7 @@ write(icardioi),nl,
functor(PredFunctor,PredName,PredArity),
'$do_error'(domain_error(flag_value,tabling_mode+Options),tabling_mode(Mod:PredName/PredArity,Options)).
% should match with code in OPTYap/opt.preds.c
%% should match with code in OPTYap/opt.preds.c
'$transl_to_pred_flag_tabling_mode'(1,batched).
'$transl_to_pred_flag_tabling_mode'(2,local).
'$transl_to_pred_flag_tabling_mode'(3,exec_answers).
@ -156,9 +158,9 @@ write(icardioi),nl,
/**************************
* abolish_table/1 *
**************************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% abolish_table/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
abolish_table(Pred) :-
'$current_module'(Mod),
@ -191,9 +193,9 @@ abolish_table(Pred) :-
/***********************
* show_table/1 *
***********************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% show_table/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
show_table(Pred) :-
'$current_module'(Mod),
@ -226,9 +228,9 @@ show_table(Pred) :-
/*****************************
* table_statistics/1 *
*****************************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% table_statistics/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
table_statistics(Pred) :-
'$current_module'(Mod),
@ -258,3 +260,33 @@ table_statistics(Pred) :-
).
'$do_table_statistics'(Mod,Pred) :-
'$do_error'(type_error(callable,Mod:Pred),table_statistics(Mod:Pred)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tabling_statistics/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% should match with code in OPTYap/opt.preds.c
tabling_statistics(total_memory,[BytesInUse,BytesAllocated]) :-
'$c_get_optyap_statistics'(0,BytesInUse,BytesAllocated).
tabling_statistics(table_entries,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(1,BytesInUse,StructsInUse).
tabling_statistics(subgoal_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(2,BytesInUse,StructsInUse).
tabling_statistics(dependency_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(3,BytesInUse,StructsInUse).
tabling_statistics(subgoal_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(6,BytesInUse,StructsInUse).
tabling_statistics(answer_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(7,BytesInUse,StructsInUse).
tabling_statistics(subgoal_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(8,BytesInUse,StructsInUse).
tabling_statistics(answer_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(9,BytesInUse,StructsInUse).
tabling_statistics(global_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(10,BytesInUse,StructsInUse).
tabling_statistics(global_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(11,BytesInUse,StructsInUse).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -1,122 +1,222 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: yapor.yap *
* Last rev: 8/2/88 *
* mods: *
* comments: support or-parallelism *
* *
*************************************************************************/
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% The YapTab/YapOr/OPTYap systems %%
%% %%
%% YapTab extends the Yap Prolog engine to support sequential tabling %%
%% YapOr extends the Yap Prolog engine to support or-parallelism %%
%% OPTYap extends the Yap Prolog engine to support or-parallel tabling %%
%% %%
%% %%
%% Yap Prolog was developed at University of Porto, Portugal %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$parallel_query'(G,[]) :- !, '$start_yapor', '$execute'(G), !,
'$parallel_yes_answer'.
'$parallel_query'(G,V) :- '$start_yapor', '$execute'(G), '$parallel_new_answer'(V).
:- meta_predicate
or_statistics(:,:),
opt_statistics(:,:),
default_sequential(:).
% ***************************
% * -------- YAPOR -------- *
% ***************************
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% or_statistics/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
or_statistics(total_memory,[BytesInUse,BytesAllocated]) :-
'$c_get_optyap_statistics'(0,BytesInUse,BytesAllocated).
or_statistics(or_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(4,BytesInUse,StructsInUse).
or_statistics(query_goal_solution_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(12,BytesInUse,StructsInUse).
or_statistics(query_goal_answer_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(13,BytesInUse,StructsInUse).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% opt_statistics/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
opt_statistics(total_memory,[BytesInUse,BytesAllocated]) :-
'$c_get_optyap_statistics'(0,BytesInUse,BytesAllocated).
opt_statistics(table_entries,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(1,BytesInUse,StructsInUse).
opt_statistics(subgoal_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(2,BytesInUse,StructsInUse).
opt_statistics(dependency_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(3,BytesInUse,StructsInUse).
opt_statistics(or_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(4,BytesInUse,StructsInUse).
opt_statistics(suspension_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(5,BytesInUse,StructsInUse).
opt_statistics(subgoal_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(6,BytesInUse,StructsInUse).
opt_statistics(answer_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(7,BytesInUse,StructsInUse).
opt_statistics(subgoal_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(8,BytesInUse,StructsInUse).
opt_statistics(answer_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(9,BytesInUse,StructsInUse).
opt_statistics(global_trie_nodes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(10,BytesInUse,StructsInUse).
opt_statistics(global_trie_hashes,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(11,BytesInUse,StructsInUse).
opt_statistics(query_goal_solution_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(12,BytesInUse,StructsInUse).
opt_statistics(query_goal_answer_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(13,BytesInUse,StructsInUse).
opt_statistics(table_subgoal_solution_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(14,BytesInUse,StructsInUse).
opt_statistics(table_subgoal_answer_frames,[BytesInUse,StructsInUse]) :-
'$c_get_optyap_statistics'(15,BytesInUse,StructsInUse).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% default_sequential/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
default_sequential(X) :-
'$default_sequential'(X), !.
'$c_default_sequential'(X), !.
default_sequential(_).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $parallel_query/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$parallel_query'(G,[]) :- !,
'$c_start_yapor',
'$execute'(G), !,
'$c_parallel_yes_answer'.
'$parallel_query'(G,V) :-
'$c_start_yapor',
'$execute'(G),
'$c_parallel_new_answer'(V).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $sequential/0 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$sequential' :-
'$default_sequential'(X),
'$initialization'('$default_sequential'(X)),
'$default_sequential'(on).
'$c_default_sequential'(X),
'$initialization'('$c_default_sequential'(X)),
'$c_default_sequential'(on).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $parallel/0 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$parallel' :-
'$default_sequential'(X),
'$initialization'('$default_sequential'(X)),
'$default_sequential'(off).
'$sequential_directive'(X,_) :- var(X), !,
write(user_error, '[ Error: argument to sequential/1 should be a predicate ]'),
nl(user_error),
fail.
'$sequential_directive'((A,B),M) :- !,
'$sequential_directive'(A,M), '$sequential_directive'(B,M).
'$sequential_directive'(M:A,_) :- !,
'$sequential_directive'(A,M).
'$sequential_directive'(A/N,M) :- integer(N), atom(A), !,
functor(T,A,N),
'$flags'(T,M,F,F),
(
X is F /\ 0x00000020, X =\= 0, !,
write(user_error, '[ Warning: '),
write(user_error, M:A/N),
write(user_error, ' is already declared as sequential ]'),
nl(user_error)
;
X is F /\ 0x1991F880, X =:= 0, !, '$sequential'(T,M)
;
write(user_error, '[ Error: '),
write(user_error, M:A/N),
write(user_error, ' cannot be declared as sequential ]'),
nl(user_error),
fail
).
'$sequential_directive'(X,_) :- write(user_error, '[ Error: '),
write(user_error, X),
write(user_error, ' is an invalid argument to sequential/1 ]'),
nl(user_error),
fail.
'$parallel_directive'(X,M) :- var(X), !,
'$do_error'(instantiation_error,parallel(M:X)).
'$parallel_directive'((A,B),M) :- !,
'$parallel_directive'(A,M),
'parallel_directive'(B,M).
'$parallel_directive'(M:A,_) :- !,
'$parallel_directive'(A,M).
'$parallel_directive'(A/N,M) :- integer(N), atom(A), !,
functor(T,A,N), '$flags'(T,M,F,F),
(
NF is F /\ 0x00000020, '$flags'(T,F,NF) ;
write(user_error, '[ Warning: '),
write(user_error, M:A/N),
write(user_error, ' is already declared as sequential ]'),
nl(user_error)
;
X is F /\ 0x1991FC80, X =:= 0, !, '$sequential'(T)
;
write(user_error, '[ Error: '),
write(user_error, M:A/N),
write(user_error, ' cannot be declared as parallel ]'),
nl(user_error),
fail
).
'$parallel_directive'(X,_) :- write(user_error, '[ Error: '),
write(user_error, X),
write(user_error, ' is an invalid argument to parallel/1 ]'),
nl(user_error),
fail.
'$c_default_sequential'(X),
'$initialization'('$c_default_sequential'(X)),
'$c_default_sequential'(off).
%
% do not try to run consult in the parallel system.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $sequential_directive/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$sequential_directive'(Pred,Mod) :-
var(Pred), !,
'$do_error'(instantiation_error,sequential(Mod:Pred)).
'$sequential_directive'(Mod:Pred,_) :- !,
'$sequential_directive'(Pred,Mod).
'$sequential_directive'((Pred1,Pred2),Mod) :- !,
'$sequential_directive'(Pred1,Mod),
'$sequential_directive'(Pred2,Mod).
'$sequential_directive'(PredName/PredArity,Mod) :-
atom(PredName), integer(PredArity),
functor(PredFunctor,PredName,PredArity), !,
'$flags'(PredFunctor,Mod,Flags,Flags),
(
Flags /\ 0x1991F880 =:= 0, !,
(
Flags /\ 0x00000020 =\= 0, !,
write(user_error, '[ Warning: '),
write(user_error, Mod:PredName/PredArity),
write(user_error, ' is already declared as sequential ]'),
nl(user_error)
;
NewFlags is Flags \/ 0x00000020,
'$flags'(PredFunctor,Mod,Flags,NewFlags)
),
;
write(user_error, '[ Error: '),
write(user_error, Mod:PredName/PredArity),
write(user_error, ' cannot be declared as sequential ]'),
nl(user_error),
fail
).
'$sequential_directive'(Pred,Mod) :-
'$do_error'(type_error(callable,Mod:Pred),sequential(Mod:Pred)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $parallel_directive/2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$parallel_directive'(Pred,Mod) :-
var(Pred), !,
'$do_error'(instantiation_error,parallel(Mod:Pred)).
'$parallel_directive'((Pred1,Pred2),Mod) :- !,
'$parallel_directive'(Pred1,Mod),
'$parallel_directive'(Pred2,Mod).
'$parallel_directive'(Mod:Pred,_) :- !,
'$parallel_directive'(Pred,Mod).
'$parallel_directive'(PredName/PredArity,Mod) :-
atom(PredName), integer(PredArity),
functor(PredFunctor,PredName,PredArity), !,
'$flags'(PredFunctor,Mod,Flags,Flags),
(
Flags /\ 0x1991F880 =:= 0, !,
(
Flags /\ 0x00000020 =:= 0, !,
write(user_error, '[ Warning: '),
write(user_error, Mod:PredName/PredArity),
write(user_error, ' is already declared as parallel ]'),
nl(user_error)
;
NewFlags is Flags /\ 0xffffffdf,
'$flags'(PredFunctor,Mod,Flags,NewFlags)
),
;
write(user_error, '[ Error: '),
write(user_error, Mod:PredName/PredArity),
write(user_error, ' cannot be declared as parallel ]'),
nl(user_error),
fail
).
'$parallel_directive'(Pred,Mod) :-
'$do_error'(type_error(callable,Mod:Pred),parallel(Mod:Pred)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $parallelizable/1 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'$parallelizable'(_) :-
nb_getval('$consulting_file',S), S\=[], !, fail.
nb_getval('$consulting_file',S), S\=[], !, fail.
'$parallelizable'((G1,G2)) :- !,
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'((G1;G2)) :- !,
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'((G1|G2)) :- !,
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'((G1->G2)) :- !,
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'(G1),
'$parallelizable'(G2).
'$parallelizable'([]) :- !, fail.
'$parallelizable'([_|_]) :- !, fail.
'$parallelizable'(consult(_)) :- !, fail.
@ -125,5 +225,4 @@ default_sequential(_).
'$parallelizable'(use_module(_)) :- !, fail.
'$parallelizable'(_).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%