verbose vs verbosity
This commit is contained in:
parent
6096c6407a
commit
67cc23725f
@ -1207,8 +1207,9 @@ Term Yap_UnknownFlag(Term mod) {
|
|||||||
|
|
||||||
Term getYapFlag(Term tflag) {
|
Term getYapFlag(Term tflag) {
|
||||||
FlagEntry *fv;
|
FlagEntry *fv;
|
||||||
flag_term *tarr;
|
flag_term *tarr;
|
||||||
if (IsVarTerm(tflag)) {
|
tflag = Deref(tflag);
|
||||||
|
if (IsVarTerm(tflag)) {
|
||||||
Yap_Error(INSTANTIATION_ERROR, tflag, "yap_flag/2");
|
Yap_Error(INSTANTIATION_ERROR, tflag, "yap_flag/2");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
@ -1234,6 +1235,10 @@ Term getYapFlag(Term tflag) {
|
|||||||
Yap_Error(TYPE_ERROR_ATOM, tflag, "yap_flag/2");
|
Yap_Error(TYPE_ERROR_ATOM, tflag, "yap_flag/2");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
if (tflag == TermSilent)
|
||||||
|
{
|
||||||
|
Yap_DebugPlWriteln(TermSilent);
|
||||||
|
}
|
||||||
fv = GetFlagProp(AtomOfTerm(tflag));
|
fv = GetFlagProp(AtomOfTerm(tflag));
|
||||||
if (!fv) {
|
if (!fv) {
|
||||||
Term fl = GLOBAL_Flags[USER_FLAGS_FLAG].at;
|
Term fl = GLOBAL_Flags[USER_FLAGS_FLAG].at;
|
||||||
|
@ -1052,13 +1052,13 @@ X_API void YAP_Init(YAP_init_args *yap_init) {
|
|||||||
MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
|
MkAtomTerm(Yap_LookupAtom(Yap_BOOTFILE)));
|
||||||
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, false);
|
setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, false);
|
||||||
} else {
|
} else {
|
||||||
|
if (yap_init->QuietMode) {
|
||||||
|
setVerbosity(TermSilent);
|
||||||
|
}
|
||||||
Yap_Restore(Yap_INPUT_STARTUP);
|
Yap_Restore(Yap_INPUT_STARTUP);
|
||||||
init_globals(yap_init);
|
init_globals(yap_init);
|
||||||
|
|
||||||
start_modules();
|
start_modules();
|
||||||
if (yap_init->QuietMode) {
|
|
||||||
setVerbosity(TermSilent);
|
|
||||||
}
|
|
||||||
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
if (yap_init->install && Yap_OUTPUT_STARTUP) {
|
||||||
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
setAtomicGlobalPrologFlag(RESOURCE_DATABASE_FLAG,
|
||||||
MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
|
MkAtomTerm(Yap_LookupAtom(Yap_INPUT_STARTUP)));
|
||||||
|
@ -357,6 +357,8 @@ static inline bool verboseMode(void) {
|
|||||||
|
|
||||||
static inline void setVerbosity(Term val) {
|
static inline void setVerbosity(Term val) {
|
||||||
GLOBAL_Flags[VERBOSE_FLAG].at = val;
|
GLOBAL_Flags[VERBOSE_FLAG].at = val;
|
||||||
|
if (val == TermSilent)
|
||||||
|
GLOBAL_Flags[VERBOSE_LOAD_FLAG].at = TermFalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool setSyntaxErrorsFlag(Term val) {
|
static inline bool setSyntaxErrorsFlag(Term val) {
|
||||||
|
@ -579,12 +579,12 @@ and if it is bound to `off` disable them. The default for YAP is
|
|||||||
is `false` by default except if YAP is booted with the `-L`
|
is `false` by default except if YAP is booted with the `-L`
|
||||||
flag.
|
flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal", NULL),
|
YAP_FLAG(VERBOSE_LOAD_FLAG, "verbose_load", true, booleanFlag, "true", NULL),
|
||||||
/**< `verbose_load `
|
/**< `verbose_load `
|
||||||
|
|
||||||
If `true` allow printing of informational messages when
|
If `true` allow printing of informational messages when
|
||||||
consulting files. If `false` disable printing these messages. It
|
consulting files. If `false` disable printing these messages. It
|
||||||
is `normal` by default except if YAP is booted with the `-L`
|
is `true` by default except if YAP is booted with the `-L`
|
||||||
flag.
|
flag.
|
||||||
*/
|
*/
|
||||||
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
|
YAP_FLAG(VERSION_FLAG, "version", false, nat, YAP_NUMERIC_VERSION, NULL),
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
sumnodes_body(3,+,+,-,+,+),
|
sumnodes_body(3,+,+,-,+,+),
|
||||||
include(1,+,-),
|
include(1,+,-),
|
||||||
exclude(1,+,-),
|
exclude(1,+,-),
|
||||||
partition(2,+,-,-),
|
partition(1,+,-,-),
|
||||||
partition(2,+,-,-,-),
|
partition(2,+,-,-,-),
|
||||||
foldl(3, +, +, -),
|
foldl(3, +, +, -),
|
||||||
foldl2(5, +, +, -, +, -),
|
foldl2(5, +, +, -, +, -),
|
||||||
|
@ -826,17 +826,17 @@ gradient_descent :-
|
|||||||
format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]),
|
format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]),
|
||||||
format(Handle,"% Iteration, train/test, QueryID, Query, GroundTruth, Prediction %~n",[]),
|
format(Handle,"% Iteration, train/test, QueryID, Query, GroundTruth, Prediction %~n",[]),
|
||||||
format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]),
|
format(Handle,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n",[]),
|
||||||
format_learning(2,'Gradient ',[]),
|
|
||||||
findall(FactID,tunable_fact(FactID,GroundTruth),L), length(L,N),
|
findall(FactID,tunable_fact(FactID,GroundTruth),L), length(L,N),
|
||||||
% leash(0),trace,
|
% leash(0),trace,
|
||||||
lbfgs_initialize(N,X,0,Solver),
|
lbfgs_initialize(N,X,0,Solver),
|
||||||
forall(tunable_fact(FactID,GroundTruth),
|
forall(tunable_fact(FactID,GroundTruth),
|
||||||
(XZ is 0.5, X[FactID] <== XZ,set_fact_probability(FactID,XZ))),
|
(XZ is 0.5, X[FactID] <== XZ,set_fact_probability(FactID,XZ))),
|
||||||
problog_flag(sigmoid_slope,Slope),
|
problog_flag(sigmoid_slope,Slope),
|
||||||
lbfgs_set_parameter(min_step, Solver, 0.0),
|
lbfgs_set_parameter(min_step, 0.0, Solver),
|
||||||
lbfgs_run(Solver,BestF),
|
lbfgs_run(Solver,BestF),
|
||||||
format('~2nOptimization done~nWe found a minimum ~4f.~n',[BestF]),
|
format('~2nOptimization done~nWe found a minimum ~4f.~n',[BestF]),
|
||||||
forall(tunable_fact(FactID,GroundTruth), set_tunable(FactID,X)),
|
forall(tunable_fact(FactID,GroundTruth), set_tunable(FactID,X)),
|
||||||
|
set_problog_flag(mse_trainset, BestF),
|
||||||
lbfgs_finalize(Solver).
|
lbfgs_finalize(Solver).
|
||||||
|
|
||||||
set_tunable(I,P) :-
|
set_tunable(I,P) :-
|
||||||
|
@ -411,8 +411,8 @@ load_files(Files0,Opts) :-
|
|||||||
Val == large -> true ;
|
Val == large -> true ;
|
||||||
'$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ).
|
'$do_error'(domain_error(unknown_option,qcompile(Val)),Call) ).
|
||||||
'$process_lf_opt'(silent, Val, Call) :-
|
'$process_lf_opt'(silent, Val, Call) :-
|
||||||
( Val == false -> yap_flag(verbose_load, full) ;
|
( Val == false -> yap_flag(verbose_load, true) ;
|
||||||
Val == true -> yap_flag(verbose_load, silent) ;
|
Val == true -> yap_flag(verbose_load, false) ;
|
||||||
'$do_error'(domain_error(out_of_domain_option,silent(Val)),Call) ).
|
'$do_error'(domain_error(out_of_domain_option,silent(Val)),Call) ).
|
||||||
'$process_lf_opt'(skip_unix_header, Val, Call) :-
|
'$process_lf_opt'(skip_unix_header, Val, Call) :-
|
||||||
( Val == false -> true ;
|
( Val == false -> true ;
|
||||||
@ -925,7 +925,7 @@ nb_setval('$if_le1vel',0).
|
|||||||
'$init_win_graphics',
|
'$init_win_graphics',
|
||||||
fail.
|
fail.
|
||||||
'$do_startup_reconsult'(X) :-
|
'$do_startup_reconsult'(X) :-
|
||||||
catch(load_files(user:X, [silent(false)]), Error, '$LoopError'(Error, consult)),
|
catch(load_files(user:X, [silent(true)]), Error, '$LoopError'(Error, consult)),
|
||||||
!,
|
!,
|
||||||
( current_prolog_flag(halt_after_consult, false) -> true ; halt).
|
( current_prolog_flag(halt_after_consult, false) -> true ; halt).
|
||||||
'$do_startup_reconsult'(_).
|
'$do_startup_reconsult'(_).
|
||||||
|
@ -603,13 +603,13 @@ be lost.
|
|||||||
% - redo resets the goal
|
% - redo resets the goal
|
||||||
% - fail gives up on the goal.
|
% - fail gives up on the goal.
|
||||||
'$re_trace_query'(abort, _G, _Module, _GoalNumber, _H) :-
|
'$re_trace_query'(abort, _G, _Module, _GoalNumber, _H) :-
|
||||||
!,
|
!,
|
||||||
abort.
|
abort.
|
||||||
'$re_trace_query'(forward(fail,G0), _G, __Module, GoalNumber, _H) :-
|
'$re_trace_query'(forward(fail,G0), _G, __Module, GoalNumber, _H) :-
|
||||||
GoalNumber =< G0,
|
GoalNumber =< G0,
|
||||||
!,
|
!,
|
||||||
fail.
|
fail.
|
||||||
'$re_trace_query'(forward(redo,G0), G, M, GoalNumber, H) :-
|
'$re_trace_query'(forward(redo,G0), G, M, GoalNumber, H) :-
|
||||||
GoalNumber > G0,
|
GoalNumber > G0,
|
||||||
!,
|
!,
|
||||||
catch(
|
catch(
|
||||||
|
@ -1009,7 +1009,7 @@ prolog:print_message(Severity, Msg) :-
|
|||||||
),
|
),
|
||||||
!.
|
!.
|
||||||
prolog:print_message(Level, _Msg) :-
|
prolog:print_message(Level, _Msg) :-
|
||||||
current_prolog_flag(verbose_load, silent),
|
current_prolog_flag(verbose_load, false),
|
||||||
stream_property(_Stream, alias(loop_stream) ),
|
stream_property(_Stream, alias(loop_stream) ),
|
||||||
Level = informational,
|
Level = informational,
|
||||||
!.
|
!.
|
||||||
|
@ -578,7 +578,6 @@ predicate_statistics(P0,NCls,Sz,ISz) :-
|
|||||||
|
|
||||||
Given predicate _P_, _NCls_ is the number of erased clauses for
|
Given predicate _P_, _NCls_ is the number of erased clauses for
|
||||||
_P_ that could not be discarded yet, _Sz_ is the amount of space
|
_P_ that could not be discarded yet, _Sz_ is the amount of space
|
||||||
taken to store those clauses (in bytes), and _IndexSz_ is the amount
|
|
||||||
of space required to store indices to those clauses (in bytes).
|
of space required to store indices to those clauses (in bytes).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
20
pl/qly.yap
20
pl/qly.yap
@ -229,6 +229,9 @@ qend_program :-
|
|||||||
% there is some ordering between flags.
|
% there is some ordering between flags.
|
||||||
'x_yap_flag'(language, V) :-
|
'x_yap_flag'(language, V) :-
|
||||||
yap_flag(language, V).
|
yap_flag(language, V).
|
||||||
|
%if silent keep silent, otherwise use the saved state.
|
||||||
|
'x_yap_flag'(verbose, _) :- !.
|
||||||
|
'x_yap_flag'(verbose_load, _) :- !.
|
||||||
'x_yap_flag'(M:P, V) :-
|
'x_yap_flag'(M:P, V) :-
|
||||||
current_module(M),
|
current_module(M),
|
||||||
yap_flag(M:P, V).
|
yap_flag(M:P, V).
|
||||||
@ -357,12 +360,9 @@ available it tries reconsulting the source file.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
qload_module(Mod) :-
|
qload_module(Mod) :-
|
||||||
( current_prolog_flag(verbose_load, true)
|
prolog_flag(verbose_load, OldF, false),
|
||||||
->
|
prolog_flag(verbose, OldV, silent),
|
||||||
Verbosity = informational
|
Verbosity = silent
|
||||||
;
|
|
||||||
current_prolog_flag(verbose_load, Verbosity)
|
|
||||||
),
|
|
||||||
StartMsg = loading_module,
|
StartMsg = loading_module,
|
||||||
EndMsg = module_loaded,
|
EndMsg = module_loaded,
|
||||||
'$current_module'(SourceModule, Mod),
|
'$current_module'(SourceModule, Mod),
|
||||||
@ -375,6 +375,8 @@ qload_module(Mod) :-
|
|||||||
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
|
||||||
print_message(Verbosity, loaded(EndMsg, File, Mod, T, H)),
|
print_message(Verbosity, loaded(EndMsg, File, Mod, T, H)),
|
||||||
'$current_module'(_, SourceModule),
|
'$current_module'(_, SourceModule),
|
||||||
|
prolog_flag(verbose_load, _, OldF),
|
||||||
|
prolog_flag(verbose, _, OldV),
|
||||||
working_directory(_, OldD).
|
working_directory(_, OldD).
|
||||||
|
|
||||||
'$qload_module'(Mod, S, SourceModule) :-
|
'$qload_module'(Mod, S, SourceModule) :-
|
||||||
@ -558,11 +560,11 @@ Restores a previously saved state of YAP contaianing a qly file _F_.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
qload_file( F0 ) :-
|
qload_file( F0 ) :-
|
||||||
( current_prolog_flag(verbose_load, true)
|
( current_prolog_flag(verbose_load, false)
|
||||||
->
|
->
|
||||||
Verbosity = informational
|
|
||||||
;
|
|
||||||
Verbosity = silent
|
Verbosity = silent
|
||||||
|
;
|
||||||
|
current_prolog_flag(verbose, Verbosity)
|
||||||
),
|
),
|
||||||
StartMsg = loading_module,
|
StartMsg = loading_module,
|
||||||
EndMsg = module_loaded,
|
EndMsg = module_loaded,
|
||||||
|
Reference in New Issue
Block a user