duplcated data is bad
This commit is contained in:
parent
7b2ff0f16d
commit
efece26020
88
INSTALL.md
Normal file
88
INSTALL.md
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
Installing YAP {#install}
|
||||
==============
|
||||
|
||||
YAP=6.3.4 is a [`cmake`]() based system. We discuss how to use `cmake`
|
||||
to install YAP, and what are the major options.
|
||||
|
||||
Compiling YAP {#CompilingYAP}
|
||||
-------------
|
||||
|
||||
To compile YAP it should be sufficient to:
|
||||
|
||||
2 create a directory, say `Build` and `cd` to the directory (`cd Build`).
|
||||
|
||||
obs: avoid compiling YAP in the src directory, some packages do not allow for that.
|
||||
|
||||
1 run `cmake`, ideally using a cmake above 3.0.
|
||||
|
||||
2 `make`.
|
||||
|
||||
3 If the compilation succeeds, try `./yap`.
|
||||
|
||||
4 If you feel satisfied with the result, do `make install`.
|
||||
|
||||
5 In most systems you will need to be superuser in order to do
|
||||
`make install` and `make info` on the standard directories.
|
||||
|
||||
Tuning the Functionality of YAP
|
||||
-------------------------------
|
||||
|
||||
By default, YAP supports tabling, depth first search, and most features found in
|
||||
modern Prologs. In some cases, you may want to suport extra features, or reduce system size.
|
||||
`cmake`provides an graphical interface for doing so. From the commmand line, a typical example could be:
|
||||
|
||||
~~~~~
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~ ~/src/yap
|
||||
~~~~~
|
||||
|
||||
The first argument says that this is a release, compiled with full optimisation. The second argument says YAP should install under the ~ drectory. In this case, YAP will add the binaries to ~/bin, include files to `~/include/Yap`, Prolog files to `~/share/Yap`, and ay DLL to `~/lib/Yap`.
|
||||
|
||||
Options include:
|
||||
|
||||
+ `CMAKE_BUILD_TYPE`: the two main options are `Debug`, for system development, and Release. to use the system.
|
||||
|
||||
+ `CMAKE_INSTALL_PREFIX`: where to install YAP, by default `/usr/local`.
|
||||
|
||||
+ WITH_DEPTH_LIMIT allows depth limited evaluation, say for
|
||||
implementing iterative deepening (default)
|
||||
|
||||
+ `WITH_CALL_TRACER` allows support for tracing all calls,
|
||||
retries, and backtracks in the system. This can help in debugging your
|
||||
application, but results in performance loss (enabled in Debug).
|
||||
|
||||
+ `WITH_WAM_PROFILER` allows profiling of abstract machine
|
||||
instructions. This is useful when developing YAP, should not be so
|
||||
useful for normal users (not currently supportted)
|
||||
|
||||
+ `WITH_YAP_CONDOR` allows using the Condor system that
|
||||
support High Throughput Computing (HTC) on large collections of
|
||||
distributively owned computing resources (not yet available)
|
||||
|
||||
+ `WITH_TABLING` allows tabling support (default)
|
||||
|
||||
+ `WITH_YAPOR_COPY` allows
|
||||
or-parallelism according to the Muse-based, YapOR model. This option is
|
||||
still highly experimental.
|
||||
|
||||
+ `WITH_GMP` give a path to where one can find the
|
||||
`GMP` library if not installed in the default path.
|
||||
It is highly advised to have GMP in your compilation environment.
|
||||
|
||||
+ `WITH_READLINE` give a path to where one can find the
|
||||
`readline` library if not installed in the default path.
|
||||
It is highly advised in Unix-like environments but not useful in Windows.
|
||||
|
||||
+ `-WITH_Threads` allows using of the multi-threading
|
||||
predicates provided by YAP.
|
||||
|
||||
You may also want to use a different compilation environment. As an example:
|
||||
|
||||
~~~~~
|
||||
cmake -GXcode ..
|
||||
~~~~~
|
||||
|
||||
will generate files for compilation of YAP within Apple's Xcode IDE.
|
||||
You can also use `xcodebuild` from the command line.
|
||||
|
242
README.md
242
README.md
@ -1,165 +1,115 @@
|
||||
|
||||
<center>
|
||||
![The YAP Logo](docs/icons/yap_128x128x32.png)
|
||||
</center>
|
||||
|
||||
README for YAP6
|
||||
README for YAP6
|
||||
====================
|
||||
|
||||
NOTE: this version of YAP is stil experimental, documentation may be out of date.
|
||||
|
||||
This directory contains a release of the YAP 6.3.* Prolog system,
|
||||
originally developed at the Universidade do Porto by Luis Damas and
|
||||
Vitor Santos Costa. YAP contains the SWI-Prolog I/O library anad a
|
||||
number of SWI-Prolog packages, originally developed by Jan Wielemaker
|
||||
and other. It includes contributions from the Edinburgh Prolog
|
||||
library, the C-Prolog manual authors, Ricardo Lopes, Ricardo Rocha,
|
||||
M. Hermenegildo, D. Cabeza, Eric Alphonse, Paulo Moura, Nuno Fonseca,
|
||||
Jan Wielemaker, Paul Singleton, Fred Dushin, Markus Triska, Ulrich
|
||||
Neumerkel, and many others. You should read the rest of this file for
|
||||
information on what YAP is and for instructions on how to build it.
|
||||
## Introduction
|
||||
|
||||
YAP 6 has been built with several versions on GCC on a variety of
|
||||
Linux, BDS, and MacOSX configurations. It has been built on Windows7
|
||||
using the mingw toolkit and cygwin from Cygnus Solutions.
|
||||
This document provides User information on version 6.3.4 of
|
||||
YAP (<em>Yet Another Prolog</em>). The YAP Prolog System is a
|
||||
high-performance Prolog compiler developed at Universidade do
|
||||
Porto. YAP supports stream Input/Output, sockets, modules,
|
||||
exceptions, Prolog debugger, C-interface, dynamic code, internal
|
||||
database, DCGs, saved states, co-routining, arrays, threads.
|
||||
|
||||
The main core of the YAP distribution is distributed under a dual
|
||||
license: the Perl Artistic license 2 and the FSF's LGPL. The YAP
|
||||
distribution also contains files distributed under the LGPL
|
||||
exclusively, and under the GPL.
|
||||
We explicitly allow both commercial and non-commercial use of YAP.
|
||||
|
||||
The YAP distribution includes several packages ported to YAP. We would
|
||||
like to take the opportunity to thank the developers of these packages
|
||||
for their generosity in allowing YAP to distribute these packages. Any
|
||||
bugs in these packages are probably our fault.
|
||||
|
||||
If you have a question about this software, desire to add code, found
|
||||
a bug, want to request a feature, or wonder how to get further
|
||||
assistance, please send e-mail to yap-users@lists.sourceforge.net. To
|
||||
subscribe to the mailing list or access the list archives, please see
|
||||
http://lists.sourceforge.net/lists/listinfo/yap-users
|
||||
|
||||
Online documentation is available for YAP at:
|
||||
|
||||
http://www.dcc.fc.up.pt/~vsc/YAP/
|
||||
|
||||
Recent versions of YAP, including both source and selected binaries,
|
||||
can be found from this same URL.
|
||||
|
||||
## What is YAP
|
||||
|
||||
The YAP Prolog System is a high-performance Prolog compiler developed
|
||||
at LIACC, Universidade do Porto. YAP provides several important
|
||||
features:
|
||||
|
||||
o speed: YAP is widely considered one of the fastest available Prolog
|
||||
systems.
|
||||
|
||||
o functionality: it supports stream I/O, sockets, modules,
|
||||
exceptions, Prolog debugger, C-interface, dynamic code, internal
|
||||
database, DCGs, saved states, co-routining, arrays.
|
||||
|
||||
o we explicitly allow both commercial and non-commercial use of YAP.
|
||||
|
||||
YAP is based on the David H. D. Warren's WAM (Warren Abstract
|
||||
Machine), with several optimizations for better performance. YAP
|
||||
follows the Edinburgh tradition, and was originally designed to be
|
||||
largely compatible with DEC-10 Prolog, Quintus Prolog, and especially
|
||||
with C-Prolog.
|
||||
YAP is based on the David H. D. Warren's WAM (Warren Abstract Machine),
|
||||
with several optimizations for better performance. YAP follows the
|
||||
Edinburgh tradition, and was originally designed to be largely
|
||||
compatible with DEC-10 Prolog, Quintus Prolog, and especially with
|
||||
C-Prolog. More recently, we have worked on being compatible with SICStus Prolog and with SWI-Prolog.
|
||||
|
||||
YAP implements most of the ISO-Prolog standard. We are striving at
|
||||
full compatibility. Moreover, we are working on integrating YAP on
|
||||
multi-programming language environments.
|
||||
|
||||
## Obtaining YAP's development sources.
|
||||
full compatibility, and the manual describes what is still
|
||||
missing.
|
||||
The document is intended neither as an introduction to Prolog nor to the
|
||||
implementation aspects of the compiler. A good introduction to
|
||||
programming in Prolog is the book @cite TheArtOfProlog , by
|
||||
L. Sterling and E. Shapiro, published by "The MIT Press, Cambridge
|
||||
MA". Other references should include the classical @cite ProgrammingInProlog , by W.F. Clocksin and C.S. Mellish, published by
|
||||
Springer-Verlag.
|
||||
|
||||
YAP is now being maintained using the git source management system. A
|
||||
public repository is available at
|
||||
YAP 6.3.4 has been built with the gcc and clang compilers on Linux and OSX machines. We expect to recover support for WIN32 machines and
|
||||
Android next.
|
||||
|
||||
https://github.com/vscosta/yap-6.3
|
||||
The overall copyright and permission notice for YAP4.3 can be found in
|
||||
the Artistic file in this directory. YAP follows the Perl Artistic
|
||||
license, and it is thus non-copylefted freeware. Some components of YAP have been obtained from SWI Prolog and ciao, and have
|
||||
different licenses.
|
||||
|
||||
Please use
|
||||
If you have a question about this software, desire to add code, found a
|
||||
bug, want to request a feature, or wonder how to get further assistance,
|
||||
please send e-mail to <yap-users AT lists.sourceforge.net>. To
|
||||
subscribe to the mailing list, visit the page
|
||||
<https://lists.sourceforge.net/lists/listinfo/yap-users>.
|
||||
|
||||
git clone git://git.code.sf.net/p/yap/yap-6.3
|
||||
|
||||
to obtain a copy of the current YAP tree.
|
||||
|
||||
Notice that the current version of YAP does not use submodules
|
||||
|
||||
3. How to compile YAP
|
||||
|
||||
First, make sure you have gmp and readline *development* packages
|
||||
installed (that is, the headers and libraries). If you are in a WIN32
|
||||
environment you will still need GMP.
|
||||
|
||||
Now, to compile YAP from the source directory just do:
|
||||
|
||||
(1) ./configure
|
||||
|
||||
(2) check the Makefile for any extensions or changes you want to make.
|
||||
|
||||
(3) make
|
||||
|
||||
(4) If the compilation succeeds, try ./yap
|
||||
|
||||
(5) Happy? "make install"
|
||||
|
||||
(6) "make install_info" will create the info files in the standard
|
||||
info directory.
|
||||
|
||||
(7) "make html" will create documentation in html format in the
|
||||
current directory.
|
||||
|
||||
In most systems you will need to be superuser so that "make
|
||||
install" can write on the standard system directories.
|
||||
|
||||
# Where to install YAP
|
||||
|
||||
YAP now uses cmake. Still, YAP try to follow GNU conventions on where
|
||||
to place software. By default, the home location is /usr/local on Unix,
|
||||
Linux, and OS/X machines.
|
||||
|
||||
You can use the `CMAKE_INSTALL_PREFIX` variable to set the YAP default
|
||||
home directory. Use the graphical interface to cmake, or from the command line
|
||||
|
||||
~~~~
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/home/xpto
|
||||
~~~~
|
||||
|
||||
|
||||
# Which YAP to compile
|
||||
|
||||
Compiling YAP with the standard options give you a Prolog with
|
||||
tabling. You can tune YAP to use extra functionality by using the
|
||||
following options to configure:
|
||||
|
||||
Compilation options:
|
||||
|
||||
* -`DWITH_Threads=ON` enables POSIX thread support. The threads library
|
||||
mostly follows the SWI design: each thread has its own stack, and
|
||||
they all share the same data-base.
|
||||
|
||||
* -`DWITH_CALL_TRACER=ON` allows support for tracing all calls,
|
||||
retries, and backtracks in the system. This can help in debugging a
|
||||
application, but results in performance loss. It is default in debug mode.
|
||||
|
||||
|
||||
# Packages and Interface Libraries
|
||||
|
||||
YAP includes a number of interface libraries. Some, like the Java
|
||||
interface JPL, have been ported from other Prologs (often from
|
||||
SWI-Prolog). Others, like the python and swig interface, have been
|
||||
developed within YAP.
|
||||
|
||||
As an example:
|
||||
|
||||
`-DWITH_CUDD` enables compilation of the CUDD library, used by
|
||||
packages such as PFL/CLP(BN) and ProbLog. The source of the CUDD
|
||||
package is available from:
|
||||
|
||||
http://vlsi.colorado.edu/~fabio/CUDD
|
||||
|
||||
Fedora Linux and MacPorts have cudd packages. In the case of Fedora,
|
||||
install cudd-devel. Ask vsc@dcc.fc.up.pt for a WIN32/WIN64 port
|
||||
|
||||
The cmake graphical interface lists all currently available external packages.
|
||||
On-line documentation is available for [YAP](http://www.dcc.fp.pt/~vsc/yap/)
|
||||
|
||||
|
||||
|
||||
We are happy to include in YAP several excellent packages developed
|
||||
under separate licenses. Our thanks to the authors for their kind
|
||||
authorization to include these packages.
|
||||
|
||||
The packages are, in alphabetical order:
|
||||
|
||||
+ The CHR package developed by Tom Schrijvers,
|
||||
Christian Holzbaur, and Jan Wielemaker.
|
||||
|
||||
+ The CLP(BN) package and Horus toolkit developed by Tiago Gomes, and Vítor Santos Costa.
|
||||
|
||||
+ The CLP(R) package developed by Leslie De Koninck, Bart Demoen, Tom
|
||||
Schrijvers, and Jan Wielemaker, based on the CLP(Q,R) implementation
|
||||
by Christian Holzbaur.
|
||||
|
||||
+ The CPLint package developed by Fabrizio Riguzzi's research
|
||||
laboratory at the [University of Ferrara](http://www.ing.unife.it/Docenti/FabrizioRiguzzi/)
|
||||
|
||||
+ The CUDA interface package developed by Carlos Martínez, Jorge
|
||||
Buenabad, Inês Dutra and Vítor Santos Costa.
|
||||
|
||||
+ The [GECODE](http://www.gecode.org) interface package developed by Denys Duchier and Vítor Santos Costa.
|
||||
|
||||
+ The [JPL](http://www.swi-prolog.org/packages/jpl/) (Java-Prolog Library) package developed by .
|
||||
|
||||
The minisat SAT solver interface developed by Michael Codish,
|
||||
Vitaly Lagoon, and Peter J. Stuckey.
|
||||
|
||||
+ The MYDDAS relational data-base interface developed at the
|
||||
Universidade do Porto by Tiago Soares, Michel Ferreira, and Ricardo Rocha.
|
||||
|
||||
+ The [PRISM](http://rjida.meijo-u.ac.jp/prism/) logic-based
|
||||
programming system for statistical modeling developed at the Sato
|
||||
Research Laboratory, TITECH, Japan.
|
||||
|
||||
+ The ProbLog 1 system developed by the [ProbLog](https://dtai.cs.kuleuven.be/problog) team in the
|
||||
DTAI group of KULeuven.
|
||||
|
||||
+ The [R](http://stoics.org.uk/~nicos/sware/packs/real/) interface package developed by Nicos Angelopoulos,
|
||||
Vítor Santos Costa, João Azevedo, Jan Wielemaker, and Rui Camacho.
|
||||
|
||||
|
||||
Downloading YAP {#download}
|
||||
==============
|
||||
|
||||
The latest development version of Yap-6 is yap-6.3.4 and can be
|
||||
obtained from the repositories
|
||||
|
||||
<http://sourceforge.net/p/yap/yap-6.3>
|
||||
|
||||
and
|
||||
|
||||
<https://github.com/vscosta/yap-6.3>
|
||||
|
||||
YAP-6.3.4 does not use modules. Please just use `git clone` to obtain the distribution.
|
||||
|
||||
Most of these repositories are basically copies of the original
|
||||
repositories at the SWI-Prolog site. YAP-6 will work either with or
|
||||
without these packages.
|
||||
|
489
docs/yap.md
489
docs/yap.md
@ -41,64 +41,6 @@ Permission is granted to make and distribute verbatim copies of this manual prov
|
||||
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
|
||||
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
|
||||
|
||||
<center>
|
||||
![The YAP Logo](yap_256x256x32.png)
|
||||
</center>
|
||||
|
||||
This file contains extracts of the SWI-Prolog manual, as written by Jan
|
||||
Wielemaker. Our thanks to the author for his kind permission in allowing
|
||||
us to include his text in this document.
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
This document provides User information on version 6.3.4 of
|
||||
YAP (<em>Yet Another Prolog</em>). The YAP Prolog System is a
|
||||
high-performance Prolog compiler developed at Universidade do
|
||||
Porto. YAP supports stream Input/Output, sockets, modules,
|
||||
exceptions, Prolog debugger, C-interface, dynamic code, internal
|
||||
database, DCGs, saved states, co-routining, arrays, threads.
|
||||
|
||||
We explicitly allow both commercial and non-commercial use of YAP.
|
||||
|
||||
|
||||
YAP is based on the David H. D. Warren's WAM (Warren Abstract Machine),
|
||||
with several optimizations for better performance. YAP follows the
|
||||
Edinburgh tradition, and was originally designed to be largely
|
||||
compatible with DEC-10 Prolog, Quintus Prolog, and especially with
|
||||
C-Prolog. More recently, we have worked on being compatible with SICStus Prolog and with SWI-Prolog.
|
||||
|
||||
YAP implements most of the ISO-Prolog standard. We are striving at
|
||||
full compatibility, and the manual describes what is still
|
||||
missing.
|
||||
The document is intended neither as an introduction to Prolog nor to the
|
||||
implementation aspects of the compiler. A good introduction to
|
||||
programming in Prolog is the book @cite TheArtOfProlog , by
|
||||
L. Sterling and E. Shapiro, published by "The MIT Press, Cambridge
|
||||
MA". Other references should include the classical @cite ProgrammingInProlog , by W.F. Clocksin and C.S. Mellish, published by
|
||||
Springer-Verlag.
|
||||
|
||||
YAP 6.3.4 has been built with the gcc and clang compilers on Linux and OSX machines. We expect to recover support for WIN32 machines and
|
||||
Android next.
|
||||
|
||||
The overall copyright and permission notice for YAP4.3 can be found in
|
||||
the Artistic file in this directory. YAP follows the Perl Artistic
|
||||
license, and it is thus non-copylefted freeware. Some components of YAP have been obtained from SWI Prolog and ciao, and have
|
||||
different ;icenses.
|
||||
|
||||
If you have a question about this software, desire to add code, found a
|
||||
bug, want to request a feature, or wonder how to get further assistance,
|
||||
please send e-mail to <yap-users AT lists.sourceforge.net>. To
|
||||
subscribe to the mailing list, visit the page
|
||||
<https://lists.sourceforge.net/lists/listinfo/yap-users>.
|
||||
|
||||
On-line documentation is available for YAP at:
|
||||
|
||||
<http://www.ncc.up.pt/~vsc/yAP/>
|
||||
|
||||
Recent versions of YAP, including both source and selected binaries,
|
||||
can be found from this same URL.
|
||||
|
||||
This manual was written by Vítor Santos Costa,
|
||||
Luís Damas, Rogério Reis, and Rúben Azevedo. The
|
||||
manual is largely based on the DECsystem-10 Prolog User's Manual by
|
||||
@ -110,438 +52,7 @@ from
|
||||
Jan Wielemaker. We would also like to gratefully
|
||||
acknowledge the contributions from Ashwin Srinivasian.
|
||||
|
||||
We are happy to include in YAP several excellent packages developed
|
||||
under separate licenses. Our thanks to the authors for their kind
|
||||
authorization to include these packages.
|
||||
|
||||
The packages are, in alphabetical order:
|
||||
|
||||
+ The CHR package developed by Tom Schrijvers,
|
||||
Christian Holzbaur, and Jan Wielemaker.
|
||||
|
||||
+ The CLP(BN) package and Horus toolkit developed by Tiago Gomes, and Vítor Santos Costa.
|
||||
|
||||
+ The CLP(R) package developed by Leslie De Koninck, Bart Demoen, Tom
|
||||
Schrijvers, and Jan Wielemaker, based on the CLP(Q,R) implementation
|
||||
by Christian Holzbaur.
|
||||
|
||||
+ The CPLint package developed by Fabrizio Riguzzi's research
|
||||
laboratory at the University of Ferrara. Please see
|
||||
|
||||
<http://www.ing.unife.it/Docenti/FabrizioRiguzzi/>
|
||||
|
||||
+ The CUDA interface package developed by Carlos Martínez, Jorge
|
||||
Buenabad, Inês Dutra and Vítor Santos Costa.
|
||||
|
||||
+ The GECODE interface package developed by Denys Duchier and Vítor Santos Costa.
|
||||
|
||||
+ The JPL (Java-Prolog Library) package developed by .
|
||||
|
||||
The minisat SAT solver interface developed by Michael Codish,
|
||||
Vitaly Lagoon, and Peter J. Stuckey.
|
||||
|
||||
+ The MYDDAS relational data-base interface developed at the
|
||||
Universidade do Porto by Tiago Soares, Michel Ferreira, and Ricardo Rocha.
|
||||
|
||||
+ The PRISM logic-based
|
||||
programming system for statistical modeling developed at the Sato
|
||||
Research Laboratory, TITECH, Japan.
|
||||
|
||||
+ The ProbLog 1 system developed by the ProbLog team in the
|
||||
DTAI group of KULeuven. For general information on ProbLog 1 and 2, please see
|
||||
|
||||
<http://dtai.cs.kuleuven.be/problog>
|
||||
|
||||
+ The `real` R interface package developed by Nicos Angelopoulos,
|
||||
Vítor Santos Costa, João Azevedo, Jan Wielemaker, and Rui Camacho.
|
||||
|
||||
+ YAP includes the `yap2swi` library that ports to YAP code from
|
||||
of SWI's PL interface. This includes the Input/Output Layer, the SWI
|
||||
Foreign Language Interface, and the RDF, archive, clib, http, odbc, plunit,
|
||||
semweb, sgml, and zlib packages written by Jan Wielemaker.
|
||||
|
||||
Downloading YAP {#download}
|
||||
==============
|
||||
|
||||
The latest development version of Yap-6 is yap-6.3.4 and can be
|
||||
obtained from the repositories
|
||||
|
||||
<http://sourceforge.net/p/yap/yap-6.3>
|
||||
|
||||
and
|
||||
|
||||
<https://github.com/vscosta/yap-6.3>
|
||||
|
||||
YAP-6.3.4 does not use repositories. Please just use `git clone` to obtain the distribution.
|
||||
|
||||
Most of these repositories are basically copies of the original
|
||||
repositories at the SWI-Prolog site. YAP-6 will work either with or
|
||||
without these packages.
|
||||
|
||||
Installing YAP {#install}
|
||||
==============
|
||||
|
||||
YAP is a `ccmake` based system. We discuss how to use `cmake`
|
||||
to install YAP, and what are the major options.
|
||||
|
||||
Compiling YAP {#CompilingYAP}
|
||||
-------------
|
||||
|
||||
To compile YAP it should be sufficient to:
|
||||
|
||||
2 create a directory, say `Build`.
|
||||
|
||||
obs: please avoid compiling YAP in the src directory, some packages do not allow for that.
|
||||
|
||||
1 run `cmake`, ideally using a cmake above 3.0.
|
||||
|
||||
2 `make`.
|
||||
|
||||
3 If the compilation succeeds, try `./yap`.
|
||||
|
||||
4 If you feel satisfied with the result, do `make install`.
|
||||
|
||||
5 In most systems you will need to be superuser in order to do
|
||||
`make install` and `make info` on the standard directories.
|
||||
|
||||
Tuning the Functionality of YAP
|
||||
-------------------------------
|
||||
|
||||
By default, YAP supports tabling, depth first search, and most features found in
|
||||
modern Prologs. In some cases, you may want to suport extra features, or reduce system size.
|
||||
`cmake`provides an graphical interface for doing so. From the commmand line, a typical example could be:
|
||||
|
||||
~~~~~
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~
|
||||
~~~~~
|
||||
|
||||
Options include:
|
||||
|
||||
+ `CMAKE_BUILD_TYPE`: the two main options are Debug, for system development, and Release. to use the system.
|
||||
|
||||
+ `CMAKE_INSTALL_PREFIX`: where to install YAP
|
||||
|
||||
+ WITH_DEPTH_LIMIT allows depth limited evaluation, say for
|
||||
implementing iterative deepening (default)
|
||||
|
||||
+ `WITH_CALL_TRACER` allows support for tracing all calls,
|
||||
retries, and backtracks in the system. This can help in debugging your
|
||||
application, but results in performance loss (enabled in Debug).
|
||||
|
||||
+ `WITH_WAM_PROFILER` allows profiling of abstract machine
|
||||
instructions. This is useful when developing YAP, should not be so
|
||||
useful for normal users (not currently supportted)
|
||||
|
||||
+ `WITH_YAP_CONDOR` allows using the Condor system that
|
||||
support High Throughput Computing (HTC) on large collections of
|
||||
distributively owned computing resources (not yet available)
|
||||
|
||||
+ `WITH_TABLING` allows tabling support (default)
|
||||
|
||||
+ `WITH_YAPOR_COPY` allows
|
||||
or-parallelism according to the Muse-based, YapOR model. This option is
|
||||
still highly experimental.
|
||||
|
||||
/*+ `--with-max-workers` allows definition of the maximum
|
||||
number of parallel processes (its value can be consulted at runtime
|
||||
using the flag `max_workers`).*/
|
||||
|
||||
+ `WITH_GMP` give a path to where one can find the
|
||||
`GMP` library if not installed in the default path. It is highly advised to have GMP in your compilation environment.
|
||||
|
||||
+ `WITH_READLINE` give a path to where one can find the
|
||||
`readline` library if not installed in the default path. It is highly advised in Unix-like environments.
|
||||
|
||||
+ `-WITH_Threads` allows using of the multi-threading
|
||||
predicates provided by YAP. Depending on the operating system, the
|
||||
option `--enable-pthread-locking` may also need to be used.
|
||||
|
||||
/*+ `--with-max-threads` allows definition of the maximum
|
||||
number of threads (the default value is 1024; its value can be consulted
|
||||
at runtime using the flag [max_threads](@ref max_threads)).*/
|
||||
|
||||
|
||||
|
||||
Next section discusses machine dependent details, and it is out-of-date.
|
||||
|
||||
Tuning YAP for a Particular Machine and Compiler {#Machine_Options}
|
||||
------------------------------------------------
|
||||
|
||||
The default options should give you best performance under
|
||||
`GCC`. Although the system is tuned for this compiler
|
||||
we have been able to compile versions of YAP under lcc in Linux,
|
||||
Sun's cc compiler, IBM's xlc, SGI's cc, and Microsoft's Visual C++
|
||||
6.0.
|
||||
|
||||
### Tuning YAP for `GCC`. {#Tuning_for_GCC}
|
||||
|
||||
YAP has been developed to take advantage of `GCC` (but not to
|
||||
depend on it). The major advantage of `GCC` is threaded code and
|
||||
explicit register reservation.
|
||||
|
||||
YAP is set by default to compile with the best compilation flags we
|
||||
know. Even so, a few specific options reduce portability. The option
|
||||
|
||||
+ `--enable-max-performance=yes` will try to support the best
|
||||
available flags for a specific architectural model. Currently, the option
|
||||
assumes a recent version of `GCC`.
|
||||
+ `--enable-debug-yap` compiles YAP so that it can be debugged
|
||||
by tools such as `dbx` or `gdb`.
|
||||
|
||||
|
||||
Here follow a few hints:
|
||||
|
||||
On x86 machines the flags:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
YAP_EXTRAS= ... -DBP_FREE=1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
tells us to use the `%bp` register (frame-pointer) as the emulator's
|
||||
program counter. This seems to be stable and is now default.
|
||||
|
||||
On Sparc/Solaris2 use:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
YAP_EXTRAS= ... -mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
and YAP will get two extra registers! This trick does not work on
|
||||
SunOS 4 machines.
|
||||
|
||||
Note that versions of GCC can be tweaked to recognize different
|
||||
processors within the same instruction set, e.g. 486, Pentium, and
|
||||
PentiumPro for the x86; or Ultrasparc, and Supersparc for
|
||||
Sparc. Unfortunately, some of these tweaks do may make YAP run slower or
|
||||
not at all in other machines with the same instruction set, so they
|
||||
cannot be made default.
|
||||
|
||||
Last, the best options also depends on the version of GCC you are using, and
|
||||
it is a good idea to consult the GCC manual under the menus "Invoking
|
||||
GCC"/"Submodel Options". Specifically, you should check
|
||||
`-march=XXX` for recent versions of GCC/EGCS. In the case of
|
||||
`GCC2.7` and other recent versions of `GCC` you can check:
|
||||
|
||||
+ 486:
|
||||
In order to take advantage of 486 specific optimizations in GCC 2.7.\*:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
YAP_EXTRAS= ... -m486 -DBP_FREE=1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+ Pentium:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
YAP_EXTRAS= ... -m486 -malign-loops=2 -malign-jumps=2 \
|
||||
-malign-functions=2
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+ PentiumPro and other recent Intel and AMD machines:
|
||||
PentiumPros are known not to require alignment. Check your version of
|
||||
`GCC` for the best `-march` option.
|
||||
|
||||
+ Super and UltraSparcs:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
YAP_EXTRAS= ... -msupersparc
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+ MIPS: if have a recent machine and you need a 64 bit wide address
|
||||
space you can use the abi 64 bits or eabi option, as in:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
CC="gcc -mabi=64" ./configure --...
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Be careful. At least for some versions of `GCC`, compiling with
|
||||
`-g` seems to result in broken code.
|
||||
|
||||
### Compiling Under MINGW's GCC {#Compiling_under_mingw}
|
||||
|
||||
|
||||
AT the time of this writing (Nov 2014), YAP uses the mkwin script to
|
||||
compile in WIN32. The script requires either a WIN32 environment, or a
|
||||
cross-compiler/emulator package.
|
||||
|
||||
YAP has been known to compile under VISUAL C++, and should compile and
|
||||
work under cygwin, but the favorite approach is to use a native
|
||||
msys/mingw environment. This approach has two key advantages:
|
||||
|
||||
+ it does not need an interface layer and a DLL, like cygwin.
|
||||
|
||||
+ it enables cross-compilation.
|
||||
|
||||
YAP uses rge `mkwin` script to generate a new YAP installer. The script is
|
||||
controlled by a set of of variables that should be defined early on in
|
||||
the text. It executes by first calling `configure`, next running `make`, and
|
||||
last (if all went well) executing `nsys`.
|
||||
|
||||
In more detail, the following mingw based environments have been
|
||||
tested to develop YAP:
|
||||
|
||||
* MSYS 1 and mingw32/64: most WIN32 development did occur in this
|
||||
native environment. Best results were achieved with
|
||||
MSYS-1.0.* and TDM-GCC:
|
||||
|
||||
mingw: http://www.mingw.org/
|
||||
original msys: http://www.mingw.org/wiki/MSYS
|
||||
mingw64: http://mingw-w64.sourceforge.net/
|
||||
TDM-GCC: http://tdm-gcc.tdragon.net/
|
||||
|
||||
* This distribution was compiled with the MSYS2 integrated
|
||||
development, that supports 32 and 64 bit compilation. Setting up
|
||||
MSYS2 should be done with care, but it is worth it as the
|
||||
distribution works nicely in MINGW32 and MINGW64 mode. A third
|
||||
compilation mode, MSYS mode, has problems with compiling sockets.
|
||||
|
||||
msys2: http://sourceforge.net/projects/msys2/
|
||||
|
||||
* cygwin and cygwin64 now can generate native applications
|
||||
|
||||
cygwin: https://www.cygwin.com/
|
||||
|
||||
* Linux has a nice cross-compilation environment, with some of the best
|
||||
work done for Fedora.
|
||||
|
||||
fedora mingw cross-compiler: http://fedoraproject.org/wiki/MinGW/CrossCompilerFramework
|
||||
|
||||
One problem is that this environment requires emulation of WIN32
|
||||
executables to generate the initial saved state and to compile
|
||||
`chr`. `wine` sometimes does the task, but it sometimes fails.
|
||||
|
||||
* OSX has the `mxe` package, a port of mingw that is in active
|
||||
development.
|
||||
|
||||
mxe: http://mxe.cc/
|
||||
|
||||
Note that OSX has technical limitations that preclude porting
|
||||
wine64. wine32 is distributed with package managers such as ports
|
||||
and brew.
|
||||
|
||||
### Setting up WIN32 compilation
|
||||
|
||||
Compiling WIN32 packages depends on a number of parameters: chosen compiler,
|
||||
packages to install, directory setup. You may have to change these ones that
|
||||
control the `mkwin` script:
|
||||
|
||||
* `VER`: major/minor number
|
||||
* `PATCHID`: third digit
|
||||
* `SRC`: directory containing yap sources, in the local environment notation.
|
||||
* `SRC_WIN`: same, but in WIN32 standard notation.
|
||||
* `THREADS`: yes or no? controllable from the command line.
|
||||
* `ABI`: "32" or "64", controllable from the command line.
|
||||
* `NSIS`: installer generator, usually "/c/Program Files (x86)/NSIS/makensis".
|
||||
* `DOCS_DIR`: where you have the doxygen output.
|
||||
* `GCC_DIR`: root of gcc seup.
|
||||
* `HOST`: argument to `--host` configure command.
|
||||
* `BUILD`: build directory
|
||||
* `GMP`: multi-precision package; yes, no, or the installation directory; usually in the distribution.
|
||||
* `CUDD`: BDD package, usually in the distribution.
|
||||
* `JAVA`: Java sdk directory, usually in the distribution.
|
||||
* `PYTHON`: Python package, usually in the distribution.
|
||||
* `R`: R environment package, usually in the distribution.
|
||||
* `GECODE`: constraint solver package, usually not in the WIN32 distribution.
|
||||
|
||||
### Compiling Under Visual C++ {#Compiling_Under_Visual_C}
|
||||
|
||||
YAP used to compile cleanly under Microsoft's Visual C++ release 6.0. We next
|
||||
give a step-by-step review on how the core YAP compiled manually using this
|
||||
environment. Newer versions of YAP will use cmake for this purpose.
|
||||
|
||||
First, it is a good idea to build YAP as a DLL:
|
||||
|
||||
+ create a project named yapdll using File.New. The project will be a
|
||||
DLL project, initially empty.
|
||||
|
||||
Notice that either the project is named yapdll or you must replace the
|
||||
preprocessors variable _$YAPDLL_EXPORTS_ to match your project names
|
||||
in the files YAPInterface.h and `c_interface.c`.
|
||||
|
||||
+ add all .c files in the $YAPSRC/C directory and in the
|
||||
$YAPSRC\\OPTYAP directory to the Project's `Source Files` (use
|
||||
FileView).
|
||||
|
||||
+ add all .h files in the _$YAPSRC/H_ directory,
|
||||
_$YAPSRC\\include_ directory and in the _$YAPSRC\\OPTYAP_
|
||||
subdirectory to the Project's `Header Files`.
|
||||
|
||||
+ Ideally, you should now use `m4` to generate extra .h from .m4 files and use
|
||||
`configure` to create a `config.h`. Or, you can be lazy, and
|
||||
fetch these files from _$YAPSRC\\VC\\include_.
|
||||
|
||||
+ You may want to go to `Build.Set Active Configuration` and
|
||||
set `Project Type` to `Release`
|
||||
|
||||
+ To use YAP's own include directories you have to set the Project
|
||||
option `Project.Project Settings.C/C++.Preprocessor.Additional Include Directories` to include the directories _$YAPSRC\\H_,
|
||||
_$YAPSRC\\VC\\include_, _$YAPSRC\\OPTYAP_ and
|
||||
_$YAPSRC\\include_. The syntax is:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
$YAPSRC\H, $YAPSRC\VC\include, $YAPSRC\OPTYAP, $YAPSRC\include
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+ Build: the system should generate an yapdll.dll and an yapdll.lib.
|
||||
|
||||
+ Copy the file yapdll.dll to your path. The file
|
||||
yapdll.lib should also be copied to a location where the linker can find it.
|
||||
|
||||
|
||||
Now you are ready to create a console interface for YAP:
|
||||
|
||||
<ol>
|
||||
<li>create a second project say `wyap` with `File.New`. The project will be a
|
||||
WIN32 console project, initially empty.
|
||||
|
||||
+ add _$YAPSRC\\console\\yap.c_ to the `Source Files`.
|
||||
|
||||
+ add _$YAPSRC\\VC\\include\\config.h_ and the files in _$YAPSRC\\include_ to
|
||||
the `Header Files`.
|
||||
|
||||
+ You may want to go to `Build.Set Active Configuration` and set
|
||||
`Project Type` to `Release`.
|
||||
|
||||
+ you will eventually need to bootstrap the system by booting from
|
||||
`boot.yap`, so write:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
-b $YAPSRC\pl\boot.yap
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
in `Project.Project Settings.Debug.Program Arguments`.
|
||||
|
||||
+ You need the sockets and yap libraries. Add
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
ws2_32.lib yapdll.lib
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
to `Project.Project Settings.Link.Object/Library Modules`
|
||||
|
||||
You may also need to set the `Link Path` so that VC++ will find `yapdll.lib`.
|
||||
|
||||
+ set `Project.Project Settings.C/C++.Preprocessor.Additional Include Directories` to include the
|
||||
_$YAPSRC/VC/include_ and
|
||||
_$YAPSRC/include_.
|
||||
|
||||
The syntax is:
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
$YAPSRC\VC\include, $YAPSRC\include
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+ Build the system.
|
||||
|
||||
+ Use `Build.Start Debug` to boot the system, and then create the saved state with
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
['$YAPSRC\\pl\\init'].
|
||||
qsave_program('startup.yss').
|
||||
^Z
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
That's it, you've got YAP and the saved state!
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
Loading and Organising YAP Programs {#consult}
|
||||
===================================
|
||||
|
Reference in New Issue
Block a user