• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H03-May-2022-286195

cnf/H03-May-2022-26,19121,214

doc/H03-May-2022-91,61081,528

etc/H03-May-2022-2,7462,105

extern/H03-May-2022-582,231441,175

grp/H03-May-2022-87,66285,596

hpcgap/H03-May-2022-234,399188,441

lib/H03-May-2022-468,560418,113

pkg/H03-May-2022-14,661,46213,905,759

src/H03-May-2022-175,287106,755

tst/H03-May-2022-84,34875,895

.appveyor.ymlH A D03-May-20222.3 KiB5547

.clang-formatH A D03-May-2022786 2926

.codecov.ymlH A D03-May-2022244 2016

.ctagsH A D03-May-20221.1 KiB1918

.editorconfigH A D03-May-2022484 2117

.mailmapH A D03-May-20221.7 KiB2726

.travis.ymlH A D03-May-20226.2 KiB178159

CHANGES.mdH A D03-May-2022260.4 KiB5,9494,378

CITATIONH A D03-May-20222.1 KiB6145

CONTRIBUTING.mdH A D03-May-20229.1 KiB214156

COPYRIGHTH A D03-May-20222.6 KiB131123

GNUmakefile.inH A D03-May-20224.4 KiB191160

INSTALL.mdH A D03-May-202228.4 KiB698508

LICENSEH A D03-May-202217.7 KiB340281

MakefileH A D03-May-2022910 2311

Makefile.rulesH A D03-May-202246.5 KiB1,331778

README.buildsys.mdH A D03-May-20229.3 KiB228165

README.hpcgap.mdH A D03-May-20225.5 KiB12498

README.mdH A D03-May-20226.2 KiB167112

aclocal.m4H A D03-May-2022643 1716

autogen.shH A D03-May-2022123 73

configureH A D03-May-2022662.5 KiB22,49818,767

configure.acH A D03-May-202223.5 KiB794675

gap.iniH A D03-May-2022127 42

README.buildsys.md

1# The GAP build system
2
3This file is meant to give an overview of how the GAP build system works. It
4is targeted at people who need to work on the build system itself (to extend
5it, fixes bugs in it, etc.). It should not be necessary to read this if all
6you want to do is compile GAP and work on the GAP library and kernel.
7
8Note that this really is just an overview; for details, please refer to the
9comments inside the various parts of the build system.
10
11
12## Prerequisites
13
14In order to work on the build system, you need at least the following:
15
16* GNU autoconf (we recommend 2.69 or later)
17* GNU make
18
19Note that we extensively use features provided by GNU make, so in general
20another version of make, such as BSD make, is not suitable.
21
22
23## Quick start: building GAP with no frills
24
25If you are working with a fresh clone of the GAP repository, you need to
26run the `autogen.sh` script first, which will generate the `configure`
27script. Afterwards, or if you are using a release version of GAP, you
28can follow the standard procedure:
29
30```
31./configure
32make
33```
34
35
36== Overview of the files constituting the GAP build system
37
38* `autogen.sh`: sets up the build system; typically the first thing to run in
39  a fresh clone of the GAP repository. It runs `autoreconf` which in turn runs
40  several tools include `aclocal`, `autoheader`, `autoconf`, `libtoolize`
41
42* `configure`: generated by `autogen.sh` from `configure.ac`.
43
44* `configure.ac`: the GNU autoconf source of our configure script.
45
46* `GNUmakefile`, `GNUmakefile.in`: The former file is generated from the
47  latter by `configure`. It is the primary Makefile (GNU make prefers it
48  over `Makefile`). It only contains variables and vpath settings, and
49  includes `Makefile.rules` for the actual build rules.
50
51* `Makefile`: This is a placeholder file, and serves two purposes:
52   1. If the user runs `make` before `configure`, it prints a warning.
53   2. If `configure` did run, but `make` is not GNU make, it produces
54      a corresponding error message.
55
56* `Makefile.rules`: This is the core of the build system. If you want
57  to add or remove a kernel C source file, you need to add or remove
58  its name here and only here.
59
60* `bin/`: This directory is created for compatibility mode (see below).
61
62* `cnf/`: All files in this directory are part of the build system.
63
64* `extern/`: External libraries we bundle with GAP (such as GMP) are
65  put in here.
66
67* `gen/`: Generated code (such as `config.h` and `gap_version.c`) is put
68  into this directory.
69
70* `obj/`: All `*.o` files are placed into this directory.
71
72- `.deps/` directories contain `*.d` files generated by the build system,
73  and which are used to track dependencies, e.g. of C source files on header
74  files.
75
76- `.libs/` directories are created by libtool. Please refer to the libtool
77  documentation for details.
78
79
80## Out-of-tree builds
81
82The old GAP build system had a concept of "configs" and "CONFIGNAME", which
83allowed you to build GAP in different configurations from a single set of
84sources. This is gone in the current build system. However, a similar goal can
85be achieved by using so-called "out-of-tree builds".
86
87In the following and also in the files that make up the build system, "srcdir"
88refers to the directory containing the GAP files, i.e. it contains this
89README, the src and lib directories and more.
90
91To create a new out-of-tree build, create a new directory anywhere
92in your filesystem. A typical setup places the out-of-tree dirs into
93subdirectories of a "build" directory inside the srcdir. So you might
94have directories
95
96```
97   srcdir/build/default
98   srcdir/build/default32
99   srcdir/build/hpcgap
100   srcdir/build/hpcgap32
101   ...
102```
103
104We will refer to this directory from now on as the "builddir".
105
106To initialize the out-of-tree build, change into the builddir and
107execute the configure script from the srcdir, like this:
108
109```
110cd $builddir
111$srcdir/configure
112```
113
114You can pass any additional options you like to configure, e.g. `ABI=32`
115or `--enable-hpcgap`.
116
117Once the configure script has completed, you can run `make` as usual,
118and all the object files and the gap executable will be placed inside
119builddir. Your srcdir will remain untouched.
120
121
122## Compatibility mode
123
124Compatibility mode emulates the build environment of the old GAP build system
125in order to allow packages with kernel extensions to be used with the new
126build system unmodified. As such, it mainly exists to ease the transition
127between new and old build system, and the plan is to remove it once all
128packages have been adapted to the new build system. However, that is still
129far off.
130
131Compatibility mode does the following things:
132
133* create `sysinfo.gap` file in the build dir
134* create a symlink `sysinfo.gap-default$ABI` pointing at `sysinfo.gap`
135* create a `bin/$GAPARCH/config.h` symlink pointing at `gen/config.h`
136* create a `bin/$GAPARCH/gac` symlink pointing at `gac`
137* create a `bin/$GAPARCH/src` symlink pointing at `$srcdir/src`
138* for out-of-tree builds, it creates a `${builddir}/src/compiled.h` file
139* ...
140
141For now, using compatibility mode is required if one wants to build the
142kernel extension for most packages which have one. In the future, we will
143provide an alternative way to do this, and also will extend `gac` to
144cleanly supported building kernel extensions.
145
146
147## Dependency tracking
148
149The build system tracks depdencies between files, such as between C source and
150header files, via `*.d` files in `.deps` directories below `obj/` and `gen/`.
151These files are mostly generated by the compiler; for this, the compiler needs
152to support the relevant flags (gcc, clang, icc all do so).
153
154For a detailed explanation of a very similar scheme, see here:
155<https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/>
156
157
158## HPC-GAP integration
159
160One of the main features of the new build system is that it optionally allows
161to build HPC-GAP instead of plain GAP. HPC-GAP is an experimental fork of GAP
162which implements concurrent programming, multi-threading, etc..
163
164The HPC-GAP kernel and library were forked from the GAP kernel and library and
165developed semi-independently for several years, with occasional merges between
166the two. In order to recombine the two, we merged the HPC-GAP fork into a
167subdirectory `hpcgap` of the GAP repository.  Then, all files inside `hpcgap`
168which were identical to their counterparts in the GAP repository were deleted
169(e.g. `hpcgap/src/ariths.c` was deleted as it was identical to `src/ariths.c`).
170At this point, `hpcgap/src` has been fully merged, but there are still files
171in `hpcgap/lib/` which differ from their counterparts in `lib/`
172
173The new build system can optionally be instructed to build HPC-GAP, by
174passing the `--enable-hpcgap` flag to the `configure` script. For the
175resulting HPC-GAP binary to work, a trick is used:  HPC-GAP mode uses multiple
176GAP root paths. Specifically, the GAP kernel function `SySetGapRootPath` was
177modified so that for every root directory `FOO` that gets added, we first add
178`FOO/hpcgap` to the list of root directories. This way, `GAPROOT/hpcgap/lib`
179is searched first for files, and only if no matching file is found there does
180GAP also search in `GAPROOT/lib`.
181
182
183## Open tasks
184
185There are many things that still need to be done in the new build system. For
186an overview, see
187<https://github.com/gap-system/gap/issues?q=is%3Aopen+is%3Aissue+label%3A%22topic%3A+build+system%22>
188
189The main open task is to add support for `make install`. There are some
190pitfalls to that, esp. when it comes to handling packages with kernel
191extensions.
192
193
194## FAQ
195
196### Q: Why don't you just use `automake`? Then you get `make install` for free!
197
198A: This is simply wrong. Using `automake` does not give us `make install`
199support for free. While it does indeed provide various parts of the puzzle,
200from our perspective those are mostly the easy ones (they may be tedious, but
201are not conceptually difficult). The real obstacles for `make install` support
202are unfortunately not resolved by using `automake`. Among these are:
203- dealing with installing the generated `config.h`. This file should ideally
204  not be installed at all and to this end not be included from any other
205  headers. But note that in GAP, currently *all* headers need to include
206  config.h directly or indirectly... Alternatively one can attempt to use
207  something like `AX_PREFIX_CONFIG_H`, but this, too, has its pitfalls
208- removing dependencies on compiler specific features in the headers and API,
209  mainly as introduced by `config.h`
210- making `gac` installable; in particular installing a version of GNU
211  libtool needed by `gac`
212- The probably hardest problem of them all is coming up with a sane way for
213  dealing with the installation of GAP packages with kernel modules in such a
214  way that existing workflows are not unduly broken. This has the added
215  difficulty that it requires convincing the authors of ~20 GAP packages to
216  apply changes needed to support this, in a way that the packages can still
217  be used with the at that time latest stable release of GAP; then getting
218  them to make releases of their packages with those changes.
219- There are probably more bits and pieces that also need to be resolved, which
220  I just can't remember right now.
221
222Of course none of this is rocket science, but it is a lot of tedious and
223finicky work, and care must be taken not to break stuff. Help with this is
224welcome, but it is strongly suggested that you first talk to us, to avoid
225disappointments (e.g. due to rejected pull requests) later on.
226
227In any case: GNU `automake` does not help with this at all.
228

README.hpcgap.md

1# HPC-GAP
2
3GAP includes experimental code to support multithreaded programming in GAP,
4dubbed HPC-GAP (where HPC stands for "high performance computing"). GAP and
5HPC-GAP codebases diverged during the project, and we are currently working
6on unifying the codebases and incorporating the HPC-GAP code back into the
7mainstream GAP versions.
8
9This is work in progress, and HPC-GAP as it is included with GAP right now
10still suffers from various limitations and problems, which we are actively
11working on to resolve. However, including it with GAP (disabled by default)
12considerably simplifies development of HPC-GAP. It also means that you can
13very easily get a (rough!) sneak peak of HPC-GAP. It comes together with the
14new manual book called "HPC-GAP Reference Manual" and located in the `doc/hpc`
15directory.
16
17Users interested in experimenting with shared memory parallel programming in
18GAP can build HPC-GAP by following the instructions from
19<https://github.com/gap-system/gap/wiki/Building-HPC-GAP>. While it is possible
20to build HPC-GAP from a release version of GAP you downloaded from the GAP
21website, due to the ongoing development of HPC-GAP, we recommend that you
22instead build HPC-GAP from the latest development version available in the
23GAP repository at GitHub, i.e., <https://github.com/gap-system/gap>.
24
25
26## HPC-GAP code in the GAP kernel
27
28Some hints on how and where to find HPC-GAP specific code in the GAP kernel:
29
30* The `hpcgap/src/` directory contains two files, `c_oper1.c` and `c_type1.c`,
31  which are counterparts to their namesakes in `src/`; all these `c_*.c` files
32  are generated by `make docomp`, which invokes the GAP compiler `gac` to
33  compile `lib/oper1.g` respectively `lib/type1.g` into C code. The `c_*.c`
34  files should never be manually edited.
35
36* Code inside `src/hpc/` is mostly HPC-GAP specific. E.g. the code for dealing
37  with threads, locks, guards, regions, atomic lists and records, etc., all can
38  be found in here.
39
40  Note that `src/hpc/serialize.{c,h}` and `src/hpc/traverse.{c,h}` might one
41  day be used in regular GAP as well, but then they would be moved from
42  `src/hpc/` to `src/`.
43
44* Most of the remaining HPC-GAP code is inside of `#ifdef HPCGAP / #endif`
45  blocks and similar constructs, and thus can be easily found by searching
46  for `HPCGAP`.
47
48* An exception to the previous rule is that `HashLock` and `HashUnlock` may be
49  called in regular GAP, too, where they do nothing and are optimized away. This
50  is for convenience, as typically code using these needs to call `HashUnlock`
51  in multiple places, i.e., at every exit of a function, making it cumbersome
52  to wrap each call into `#ifdef HPCGAP / #endif`.
53
54* The interface to the Boehm garbage collector in `src/boehm_gc.c` is in theory
55  not limited to HPC-GAP, but in practice it is, at least for now.
56
57
58## HPC-GAP code in the GAP library
59
60Normally, the GAP library is contained in the `lib` directory inside the
61GAPROOT directory. But when GAP is compiled and run in HPC-GAP code mode, then
62whenever a library file is to be loaded, it first looks for that file inside
63`hpcgap/lib/`, and only if that fails, then it falls back to searching in
64`lib`. This allows us to take a file from `lib`, duplicate it into `hpcgap/lib`,
65and then apply HPC-GAP specific changes.
66
67However, we try to keep such duplicated files to a minimum, as it is cumbersome
68to maintain them: if `lib/foo.gi` is modified, then one must always remember to
69also apply the same changes to its clone twin `hpcpgap/lib/foo.gi`.
70
71Instead, it is preferable to place HPC-GAP specific code inside a conditional
72using `IsHPCGAP`, like this:
73
74```
75  if IsHPCGAP then
76     # perform HPC-GAP specific actions
77  else
78    # perform altrnative actions for regular GAP
79  fi;
80```
81
82Note that `IsHPCGAP` is a global constant, set to either `true` or `false` by
83the kernel before loading the library. Since GAP optimizes conditionals using
84global constants away, the above code actually has zero performance overhead
85when compared to the version not using it. I.e., `if IsHPCGAP` in GAP code
86behaves similarly to `#ifdef HPCGAP` in C code.
87
88As a caveat to this, code which needs to use `atomic` statements usually is
89difficult to write using `if IsHPCGAP` without duplicating a lot of code. For
90this reason, we allow using `atomic` statements in regular GAP, too, where
91they have no effect and also cause zero overhead. Exploiting this, we allow
92ourselves to use `atomic` outside of `if IsHPCGAP then ... fi` in some limited
93cases inside the `lib/` directory. However, it is recommended to keep this to
94a minimum, as the code becomes harder to understand and maintain for people
95who are not familiar with HPC-GAP. Instead, it is preferable to find other
96solutions, such as high-level abstractions which can be used uniformly by
97regular GAP and HPC-GAP code, which encapsulate and hide the HPC specifics. An
98example for that is `MemoizePosIntFunction`. See also
99<https://github.com/gap-system/gap/issues/1889>.
100
101As of the time this is written, only the following library files in `lib`
102make use of `atomic` statements:
103
104  1. `lib/coll.gd`
105  1. `lib/coll.gi`
106  1. `lib/filter.g`
107  1. `lib/grppc.gi`
108  1. `lib/helpdef.gi`
109  1. `lib/info.gi`
110  1. `lib/methwhy.g`
111  1. `lib/oper.g`
112  1. `lib/package.gi`
113  1. `lib/profile.g`
114  1. `lib/type.g`
115
116Some further places with HPC-GAP specific code include the following:
117
118* `hpcgap/lib/hpc/` and `hpcgap/lib/distributed/` contain all truly HPC-GAP
119  specific code.
120
121* `lib/hpc/` contains placeholders for some of the code in `hpcgap/lib/hpc/`,
122   make it writing code which works in both regular GAP and HPC-GAP more
123   convenient.
124

README.md

1[![Travis build Status](https://travis-ci.org/gap-system/gap.svg?branch=master)](https://travis-ci.org/gap-system/gap)
2[![AppVeyor build Status](https://ci.appveyor.com/api/projects/status/github/gap-system/gap?branch=master&svg=true)](https://ci.appveyor.com/project/gap-system/gap)
3[![Code Coverage](https://codecov.io/github/gap-system/gap/coverage.svg?branch=master&token=)](https://codecov.io/gh/gap-system/gap)
4[![Coverage Status](https://coveralls.io/repos/github/gap-system/gap/badge.svg)](https://coveralls.io/github/gap-system/gap)
5
6# What is GAP?
7
8GAP is a system for computational discrete algebra, with particular emphasis
9on computational group theory. GAP provides a programming language, a library
10of thousands of functions implementing algebraic algorithms written in the GAP
11language as well as large data libraries of algebraic objects. For a more
12detailed overview, see
13  <https://www.gap-system.org/Overview/overview.html>.
14For a description of the mathematical capabilities, see
15  <https://www.gap-system.org/Overview/Capabilities/capabilities.html>.
16
17GAP is used in research and teaching for studying groups and their
18representations, rings, vector spaces, algebras, combinatorial structures, and
19more. The system, including source, is distributed freely. You can study and
20easily modify or extend it for your special use.
21
22
23# How to obtain GAP?
24
25## Download a stable release version
26
27The latest stable release of the GAP system, including all currently
28redistributed GAP packages, can be obtained from
29  <https://www.gap-system.org/Releases/index.html>.
30Afterwards, follow the instructions in the file `INSTALL.md` in the GAP root
31directory.
32
33
34# Using a GAP development version
35
36Alternatively, you can compile the latest development version of GAP. However,
37most users should instead use the latest official release instead as described
38in the previous section.
39
40If you really want to use a development version of GAP, start by cloning the
41GAP source repository using git:
42
43    git clone https://github.com/gap-system/gap
44
45
46## Installing required dependencies
47
48In this case, you need to have some more software dependencies installed than
49with a stable release in order to compile GAP. In particular, you need at
50least these:
51
52* a C compiler, e.g. GCC or Clang
53* a C++ compiler
54* GNU Make
55* GNU Autoconf
56* GNU Libtool
57
58In addition, we recommend that you install at least the following optional
59dependencies:
60* Development headers for GMP, the GNU Multiple Precision Arithmetic Library
61* Development headers for zlib
62* Development headers for GNU Readline
63
64On Ubuntu or Debian, you can install these with the following command:
65
66    sudo apt-get install build-essential autoconf libtool libgmp-dev libreadline-dev zlib1g-dev
67
68On macOS, you can install the dependencies in several ways:
69
70 * using Homebrew: `brew install autoconf libtool gmp readline`
71 * using Fink: `fink install autoconf2.6 libtool2 gmp5 readline7`
72 * using MacPorts: `port install autoconf libtool gmp readline`
73
74On other operating systems, you will need to figure out equivalent commands
75to install the required dependencies.
76
77
78## Building GAP
79
80Then to build GAP, first run this command to generate the `configure` script:
81
82    ./autogen.sh
83
84Afterwards you can proceed similar to what is described in `INSTALL.md`, in
85particular enter the following commands to compile GAP itself (for macOS users,
86see below for a few additional hints):
87
88    ./configure
89    make
90
91For macOS users you may ned to tell GAP where it can find these dependencies.
92
93For Homebrew, use these commands:
94
95    ./configure --with-readline=/usr/local/opt/readline
96    make
97
98For Fink, use these commands:
99
100    ./configure CPPFLAGS=-I/sw/include LDFLAGS=-L/sw/lib
101    make
102
103For MacPorts, use these commands:
104
105    ./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
106    make
107
108
109## Obtaining the GAP package distribution
110
111In contrast to the GAP stable releases, the development version does not come
112bundled with all the GAP packages. Therefore, if you do not have a GAP package
113archive yet, we recommend that you bootstrap the stable versions of packages
114by executing one of the following commands. Whether you choose to
115`bootstrap-pkg-minimal` or `bootstrap-pkg-full` depends on your needs for
116development.
117
118    make bootstrap-pkg-minimal
119
120or
121
122    make bootstrap-pkg-full
123
124In the latter case please note that `make bootstrap-pkg-full` only unpacks packages
125but does not build those of them that require compilation. You can change to the
126`pkg` directory and then call `../bin/BuildPackages.sh` from there to build as many
127packages as possible.
128
129If everything goes well, you should be able to start GAP by executing
130
131    sh bin/gap.sh
132
133You can also find development versions of some of the GAP packages on
134<https://github.com/gap-packages> resp. on <https://gap-packages.github.io>.
135
136
137# We welcome contributions
138
139The GAP Project welcomes contributions from everyone, in the shape of code,
140documentation, blog posts, or other. For contributions to this repository,
141please read the [guidelines](CONTRIBUTING.md).
142
143To keep up to date on GAP news (discussion of problems, release announcements,
144bug fixes), you can subscribe to the
145[GAP forum](https://www.gap-system.org/Contacts/Forum/forum.html) and
146[GAP development](https://mail.gap-system.org/mailman/listinfo/gap) mailing lists,
147notifications on GitHub, and follow us on [Twitter](https://twitter.com/gap_system).
148
149If you have any questions about working with GAP, you can ask them on
150[GAP forum](https://www.gap-system.org/Contacts/Forum/forum.html) (requires subscription)
151or [GAP Support](https://www.gap-system.org/Contacts/People/supportgroup.html) mailing lists.
152
153Please tell us about your use of GAP in research or teaching. We maintain a
154[bibliography of publications citing GAP](https://www.gap-system.org/Doc/Bib/bib.html).
155Please [help us](https://www.gap-system.org/Contacts/publicationfeedback.html)
156keeping it up to date.
157
158
159# License
160
161GAP is free software; you can redistribute it and/or modify it under the terms
162of the GNU General Public License as published by the Free Software
163Foundation; either version 2 of the License, or (at your option) any later
164version. For details, please refer to the GAP reference manual, as well as the
165file `LICENSE` in the root directory of the GAP distribution or see
166<https://www.gnu.org/licenses/gpl.html>.
167