-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathsac4snet.txt
242 lines (159 loc) · 7.9 KB
/
sac4snet.txt
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
============================
Sac4snet interface plugin
============================
:Author:
Jaroslav Sykora (jara)
Examples
----------
A couple of examples is located in examples/tests/SAC
SAC / LPEL / S-Net Installation instructions
-----------------------------------------------
Source code packages
~~~~~~~~~~~~~~~~~~~~~~
Create an empty directory (e.g. $HOME/advance) and download the packages listed below into it:
Portable Coroutine Library (PCL)
http://www.xmailserver.org/libpcl.html
Lightweight Parallel Execution Layer (LPEL)
git clone git://github.com/snetdev/lpel.git
SAC Compiler (sac2c)
svn co svn+ssh://[email protected]/repositories/sac/sac2c/trunk sac2c
SAC StdLib (stdlib)
svn co svn+ssh://[email protected]/repositories/sac/stdlib/trunk stdlib
S-NET Run-time System (snet-rts)
git clone git://github.com/snetdev/snet-rts.git
S-NET Compiler (snetc)
svn co svn+ssh://[email protected]/repositories/snet/code/trunk/src/snetc snetc
Dependency graph
~~~~~~~~~~~~~~~~~
::
PCL <-- LPEL <-+--------------------<-- snet-rts <-- snetc <-- snet-rts/examples
| |
`-- sac2c <-- stdlib <-----'
Building order
~~~~~~~~~~~~~~~~
Generally speaking, the S-NET-related packages need to be *installed* into their final locations
after being built using 'make install', while the SAC-related packages (the sac2c compiler and stdlib)
need not.
First of all, a couple of environment variables must be set:
For SAC::
export SACBASE=$HOME/advance
export SAC2CBASE=$SACBASE/sac2c
export PATH=$PATH:$SAC2CBASE/bin
export SVN_EDITOR=/bin/vi
For SNET::
SNETBASE=/usr/local
export SNET_LIBS=$SNETBASE/lib/snet
export SNET_INCLUDES=$SNETBASE/include/snet
export SNET_MISC=$SNETBASE/share/snet
export LD_LIBRARY_PATH=$SNET_LIBS:$SNETBASE/lib:$LD_LIBRARY_PATH
export PATH=$SNETBASE/bin:$PATH
It is perhaps best to create a shell script called 'settings.sh' in the top-level directory ($HOME/advance),
put these commands in it, and then 'source' it into the shell session every time you start working.
It is NOT recomended to put the commands into a .bashrc or similar file.
For simplicity, this manual assumes the SNET software will be installed into the standard installation
path "/usr/local". It is possible to install into a different location (e.g. $HOME/advance/local).
This section shows the order in which the software has to be built:
1. pcl
Use "./configure --prefix=/usr/local",
then "make && make install"
2. lpel
If the source code has been checked out directly from the source repository,
you first need to create the configure script by running: "./build-aux/boostrap".
Then use the standard: "./configure --prefix=/usr/local --with-pcl=/usr/local"
and "make && make install"
Hint: Check the configure log to make sure that pcl was detected.
3. sac2c
Use "./configure --with-lpel-include-path=/usr/local/include"
then: "make" to build the compiler itself,
then: "make CROSS=lpel" to build the lpel-enabled cross-compiler.
You may decorate the make commands with "-j4" or similar to your liking.
Hint: Check the configure log to make sure that lpel was detected.
4. stdlib
The basic command to build stdlib for SNet is::
make CROSS=lpel mtfast
For a slightly increased build speed you may decorate with "-j" and "MODE=lean".
Important: If the LPEL library has been installed into a non-standard location
you will need to specify the CCFLAG option to direct the gcc compiler.
Suppose we are installing everything into "$HOME/advance/local" instead
of "/usr/local". The stdlib make command would read::
make CROSS=lpel mtfast CCFLAG="-I$HOME/advance/local/include -L$HOME/advance/local/lib -Wl,-rpath,$HOME/advance/local/lib"
This is because the gcc compiler invoked from sac2c needs to know where to
find the library.
5. snet-rts
Use "./configure --prefix=/usr/local".
If LPEL hasn't been detected we may add:
"--with-lpel-includes=/usr/local/include --with-lpel-libs=/usr/local/lib"
Then: "make && make install"
This installs libraries into "$PREFIX/lib/snet"
6. snetc
Use "./configure --prefix=/usr/local"
If installing into a non-standard path, add::
CFLAGS="-I$HOME/advance/local/include" LDFLAGS="-L$HOME/advance/local/lib"
Then "make" to build the compiler.
The executable file "snetc" is left in the package's top directory;
create a symlink to it from "/usr/local/bin".
7. examples
Build a primitive test/example in "snet-rts/examples/tests/SAC/gigo1"
using "make". This produces the file "gigo-lpel".
Run the program like this::
MMAP=-1,2,4 ./gigo-lpel <input2.xml
Friendly hints
~~~~~~~~~~~~~~~~
It is actually quite wise NOT to use the standard installation path "/usr/local",
but instead to install into a more specific location, such as "$HOME/advance/local".
This allows to keep several versions of the system side by side.
Should the sac2c compiler go crazy about module version mismatch, you may try purging
the snet/sac libraries in "/usr/local/lib/snet".
Don't forget to run "make install" after each update and re-compilation cycle
in lpel and snet-rts packages!
Box metadata in .snet source files
-----------------------------------
"SACmodule"
~~~~~~~~~~~~
Name of the SAC module library that contains the box function.
"SACboxfun"
~~~~~~~~~~~~
Function name in the SAC module.
"SACdefaultmap"
~~~~~~~~~~~~~~~~
Default mapping of SAC bees (tasks) to LPEL workers.
Two possible formats:
a) Comma separated list of worker IDs (integers).
Example::
<SACdefaultmap>-1, 2, 3, 0</SACdefaultmap>
This assigns workers 2, 3, and 0 to SAC slave bees.
The placement of the queen bee (the first integer) is determined
by the snet system and cannot be influenced from within SAC, hence
the value -1 should be always specified at the position.
b) Name of an environment variable that will hold the list of worker IDs.
The variable name starts by the '$' character.
Example::
<SACdefaultmap>$AMAP</SACdefaultmap>
When the snet program starts it will look for the environment variable AMAP,
and expect to find a list of worker IDs in it.
So, the program may be executed like this::
AMAP=-1,1,2 ./gigo_1-lpel <wkload-A00.xml
The same note as above regarding the placement of the queen bee applies as well.
Diagnostics
--------------
**Mapping specification**::
*** SAC runtime warning
*** LPEL::SAC_MT_AllocHive: the mapping specification 'places[0]' is not used, it shall be -1 to suppress the warning.
The "SACdefaultmap" metadata tag allows to specify the placement of SAC slave bees (tasks) onto the LPEL workers.
However, the SAC runtime cannot modify or influence the placement of the queen bee (that is, the "main" box task).
Therefore, the worker ID at the first position is unused in SAC and should be -1.
Most likely you have something like this::
<SACdefaultmap>0, 1, 2</SACdefaultmap>
which incorrectly suggests that the queen bee will be placed on worker 0.
You have to change that to::
<SACdefaultmap>-1, 1, 2</SACdefaultmap>
because you nor me don't know where the queen will be.
**No hive attached**::
*** SAC runtime warning
*** In SAC4SNetFibreIO__PrintDoubleArray2: there was no hive attached to the calling thread!
Created a temporary hive of one. The warning will not be repeated for this function.
The SAC printing function is called without an execution realm properly set-up.
**Environmet variable not found**::
(SNET FATAL (NODE 0 THREAD 46951069190544)In SNetExeRealm_create__mmul: the variable 'MMAP' not found in the environment!)
The variable MMAP was not found in the environment. It has been specified in one of the <SACdefaultmap> tags like this::
<SACdefaultmap>$MMAP</SACdefaultmap>