-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathINSTALL
64 lines (40 loc) · 2.12 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Installation
============
To install without running tests or benchmarks, type the following commands:
make install PREFIX=[BASEDIR]
This installs the header files 'rarray' and 'rarrayio' in the "[BASEDIR]/include" directory, and the documentation in "[BASEDIR]/share/doc".
+Alternatively, because rarray is a header-only library consisting of two header files, rarray and rarrayio (generated from partial headers, but are kept up-to-date in the github repo), installation can be also done by simply copying these header files to the correct location (e.g. "cp rarray rarrayio [BASEDIR]/include").
If the include directory is not in the compiler's search path, you will need to pass an option to the compiler directing to that directory (i.e. -I[BASEDIR]/include) or, for gcc and intel compilers, you could set the CPATH environment variable.
If you have sudo permissions, you can also do
sudo make install
to install the header and documentation to /usr/include and /usr/share/doc, respectively. Note that this will fail on recent MacOS versions, where one should run "sudo make install PREFIX=/usr/local" instead.
Testing
=======
To compile and run the unit tests and benchmarks:
./configure
make test
make benchmark
The configure command should work if you have a recent gnu, intel, ibm or clang compiler.
The tests require the valgrind utility.
Usage
=====
To use the rarray library, you must
- Include the header <rarray> and, for io, also <rarrayio>.
- Compile the code using a c++11 compiler
(e.g., use -std=c++11 for g++).
- If rarray was not installed in the compiler's search path,
you will need to pass an option to the compiler directing to that
directory (i.e. -I[BASEDIR]/include).
- If it highly recommended to compile with optimization flags on
(e.g. "-march=native -O3 -fstrict-aliasing" for g++).
Example:
// example.cpp
#include <rarray>
#include <rarrayio>
int main() {
rarray<int,2> a(2,2);
a = 1,2,3,4;
std::cout << a << std::endl;
}
If compiling with g++:
g++ -std=c++11 -march=native -O3 -fstrict-aliasing example.cpp