installation.rst 63 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Installation of Eiger computer at ESRF
======================================

BIOS
----

Disable CPU power management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'lid10eiger1' - Detector PC Type B
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

`High Performance Detector PC Type B <http://wikiserv.esrf.fr/bliss/index.php/High_Performance_Detector_PC#Fourth_Generation_-_E4.2FSupermicro_-_CCTF_Detector_PC_Type-B>`_

In the 'Advanced -> CPU Configuration' menu

+-----------------+---------+
18
| Hyper-Threading | Enable  |
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
+-----------------+---------+

In the 'Advanced -> CPU Configuration -> CPU Power Management
Configuration' menu

+--------------------+-------------+
| Power Technology   | Disable     |
+--------------------+-------------+
| Energy Performance | Performance |
+--------------------+-------------+

Disable boot on Intel 10 Gigabit Converged Network adapter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the 'Boot -> Set Boot Priority' menu select:

+-----------------+--------------------------+
| 1st Boot Device | Hard Disk:P0: SATADOM-SL |
+-----------------+--------------------------+

In the 'Advanced -> Intel(R) Ethernet Controller 10 Gigabit X540-AT2'
(first) menu note the field:

+-------------+----------+
| PCI Address | 07:00:00 |
+-------------+----------+

It is referred to in other menu as Slot 0700. Then in the 'Boot ->
Network Device BBS Priorities' menu disable all the Intel X520 ports,
and leave only the Intel X540-AT2 ports:

+------------+------------------------+
| 1st Device | IBA XE Slot 0700 v2304 |
+------------+------------------------+
| 2nd Device | Disabled               |
+------------+------------------------+
| 3rd Device | Disabled               |
+------------+------------------------+
| 4th Device | Disabled               |
+------------+------------------------+
| 5th Device | Disabled               |
+------------+------------------------+

Debian 7
--------

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
*Linux kernel*
~~~~~~~~~~~~~~

Update the *Linux kernel* from Debian repository in order to improve system reliability:

::

    # as root
    lid10eiger1:~ # linux_ver=$(dpkg --list linux-image-3.2\* | grep '^ii' | awk '{print $3}')
    lid10eiger1:~ # echo ${linux_ver}
    3.2.82-1

    lid10eiger1:~ # linux_pkgs=$(dpkg --list linux\* | grep ${linux_ver} | awk '{print $2}')
    lid10eiger1:~ # echo "${linux_pkgs}"
    linux-doc-3.2
    linux-headers-3.2.0-4-all-amd64
    linux-headers-3.2.0-4-amd64
    linux-headers-3.2.0-4-common
    linux-headers-3.2.0-4-common-rt
    linux-headers-3.2.0-4-rt-amd64
    linux-image-3.2.0-4-amd64
    linux-libc-dev:amd64
    linux-manual-3.2

    lid10eiger1:~ # apt-get install ${linux_pkgs}
    ...
    Get:1 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-image-3.2.0-4-amd64 amd64 3.2.96-2 [23.5 MB]
    Get:2 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-doc-3.2 all 3.2.102-1 [6,501 kB]
    Get:3 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-headers-3.2.0-4-all-amd64 amd64 3.2.96-2 [270 kB]
    Get:4 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-headers-3.2.0-4-amd64 amd64 3.2.96-2 [671 kB]
    Get:5 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-headers-3.2.0-4-common amd64 3.2.96-2 [3,641 kB]
    Get:6 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-headers-3.2.0-4-rt-amd64 amd64 3.2.96-2 [671 kB]
    Get:7 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-headers-3.2.0-4-common-rt amd64 3.2.96-2 [3,646 kB]
    Get:8 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-libc-dev amd64 3.2.102-1 [890 kB]
    Get:9 http://lin-repo-master.esrf.fr/debian/stable/debian-security/ wheezy/updates/main linux-manual-3.2 all 3.2.102-1 [3,051 kB]
    ...
    
102
103
104
105
106
107
108
109
110
111
112
113
*libc*
~~~~~~

The Debian 7 *libc* is 2.13-38+deb7u11, built from *eglibc-2.13*. This
version has a bug in *malloc*, corrupting memory in heavyly
multi-threaded applications. A recompiled version of *libc*, modified
with selected upstream patches, must be installed so the SlsDetector
software can run properly:

::

    # as root
114
    lid10eiger1:~ # mkdir -p ~/libc && cd ~/libc
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
    lid10eiger1:~/libc # scp lid01eiger1:/nobackup/lid01eiger12/devel/libc/apt-get-source/eglibc-2.13/modified-02/*.deb .
    ...
    lid10eiger1:~/libc # dpkg --install libc6_2.13-38+deb7u10_amd64.deb \
      libc6-dbg_2.13-38+deb7u10_amd64.deb libc6-dev_2.13-38+deb7u10_amd64.deb \
      libc6-dev-i386_2.13-38+deb7u10_amd64.deb \
      libc6-i386_2.13-38+deb7u10_amd64.deb \
      libc-bin_2.13-38+deb7u10_amd64.deb  libc-dev-bin_2.13-38+deb7u10_amd64.deb \
      locales_2.13-38+deb7u10_all.deb locales-all_2.13-38+deb7u10_amd64.deb \
      multiarch-support_2.13-38+deb7u10_amd64.deb libc6_2.13-38+deb7u10_i386.deb \
      libc-bin_2.13-38+deb7u10_i386.deb libc6-i686_2.13-38+deb7u10_i386.deb
    ...
    lid10eiger1:~/libc # dpkg --list libc\* | grep 2.13-38
    ii  libc-bin         2.13-38+deb7u10  i386   Embedded GNU C Library: Binaries
    ii  libc-dev-bin     2.13-38+deb7u10  amd64  Embedded GNU C Library: Development binaries
    ii  libc6:amd64      2.13-38+deb7u10  amd64  Embedded GNU C Library: Shared libraries
    ii  libc6:i386       2.13-38+deb7u10  i386   Embedded GNU C Library: Shared libraries
    ii  libc6-dbg:amd64  2.13-38+deb7u10  amd64  Embedded GNU C Library: detached debugging symbols
    ii  libc6-dev:amd64  2.13-38+deb7u10  amd64  Embedded GNU C Library: Development Libraries and Header Files
    ii  libc6-dev-i386   2.13-38+deb7u10  amd64  Embedded GNU C Library: 32-bit development libraries for AMD64
    ii  libc6-i386       2.13-38+deb7u10  amd64  Embedded GNU C Library: 32-bit shared libraries for AMD64
    ii  libc6-i686:i386  2.13-38+deb7u10  i386   Embedded GNU C Library: Shared libraries [i686 optimized]

137
138
139
140
141
142
143
144
145
Copy the good *getconf* binary (64-bit):

::

    lid10eiger1:~ # cd /usr/bin
    lid10eiger1:/usr/bin # mv getconf getconf.32
    lid10eiger1:~ # scp lid01eiger1:/usr/bin/getconf .
    ...

146
147
148
149
150
151
152
153
154
155
156
*cpufrequtils*
~~~~~~~~~~~~~~

The previous settings disable the ACPI CPU power management interface,
so the *loadcpufreq* INIT service will not be able to load
*acpi-cpufreq* kernel module. In case this is enabled in BIOS in the
future, force the 'performance' governor in *cpufrequtils* INIT service:

::

    # as root
157
    lid10eiger1:~ # cat > /etc/default/cpufrequtils <<'EOF'
158
159
160
    # valid values: userspace conservative powersave ondemand performance
    # get them from cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
    GOVERNOR="performance"
161
    EOF
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

*irqbalance*
~~~~~~~~~~~~

The *irqbalance* must be installed in order to distribute hardware IRQs
to different CPU cores:

::

    # as root
    lid10eiger1:~ # apt-get install irqbalance
    ...

Disk configuration
~~~~~~~~~~~~~~~~~~

Find the 4 TByte RAID-0 array in Debian (**/dev/sda**):

::

    # as root
    lid10eiger1:~ # for d in /sys/block/sd?; do \
        echo "$(basename ${d}): model=$(cat ${d}/device/model)" \
             "size=$(python -c "print \"%.1f MB\" % ($(cat ${d}/size) / (2*1024.0**2))")"; \
    done
    sda: model=LSI2208          size=3811.0 MB
    sdb: model=SATADOM-SL 3ME   size=59.6 MB

Install *parted* and use it to create a *GPT* and a RAID partition on
the entire disk:

::

    lid10eiger1:~ # apt-get install parted
    ...
    lid10eiger1:~ # parted /dev/sda
    GNU Parted 2.3
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.

    (parted) mklabel gpt

    (parted) unit s

    (parted) print free
    Model: SMC LSI2208 (scsi)
    Model: SMC LSI2208 (scsi)
    Disk /dev/sda: 7992180736s
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt

    Number  Start  End          Size         File system  Name  Flags
            34s    7992180702s  7992180669s  Free Space

    (parted) mkpart logical 2048s 7992178687s

    (parted) set 1 raid on

    (parted) print free
    Model: SMC LSI2208 (scsi)
    Disk /dev/sda: 7992180736s
    Sector size (logical/physical): 512B/512B
    Partition Table: gpt

    Number  Start        End          Size         File system  Name     Flags
            34s          2047s        2014s        Free Space
     1      2048s        7992178687s  7992176640s               logical  raid
            7992178688s  7992180702s  2015s        Free Space

    (parted) quit
    Information: You may need to update /etc/fstab.

234
235
.. note:: the partition is aligned to 2048 sectors (1 MByte). The end sector
   is obtained by:
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

::

    7992180702 - 7992180702 % 2048 - 1 = 7992178687

Create the filesystem and mount it:

::

    lid10eiger1:~ # mkfs.ext4 /dev/sda1
    mke2fs 1.42.5 (29-Jul-2012)
    ...

    lid10eiger1:~ # blkid /dev/sda1
    /dev/sda1: UUID="aff827d8-a744-470d-a753-998919f36d77" TYPE="ext4"

    lid10eiger1:~ # mkdir -p /nobackup/lid10eiger12

    lid10eiger1:~ # cat /etc/fstab
    ...
    UUID="aff827d8-a744-470d-a753-998919f36d77" /nobackup/lid10eiger12        ext4    relatime,nodev,nosuid 0       2

    lid10eiger1:~ # mount /nobackup/lid10eiger12

    lid10eiger1:~ # df -h /nobackup/lid10eiger12
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/sda1       3.7T  196M  3.5T   1% /nobackup/lid10eiger12

    lid10eiger1:~ # mkdir /nobackup/lid10eiger12/data
    lid10eiger1:~ # chmod a+w /nobackup/lid10eiger12/data

Test the effective write speed:

::

    lid10eiger1:~ # mkdir /nobackup/lid10eiger12/data/eiger
    lid10eiger1:~ # chmod a+w /nobackup/lid10eiger12/data/eiger
    lid10eiger1:~ # dd if=/dev/zero bs=8M count=4096 of=/nobackup/lid10eiger12/data/eiger/test.raw
    4096+0 records in
    4096+0 records out
    34359738368 bytes (34 GB) copied, 32.3067 s, 1.1 GB/s

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
Conda volume
~~~~~~~~~~~~

Reduce the *data* volume in order to create a *conda* volume
and mount it on */opt/bliss/conda*:

::

    # as root
    
    lid10eiger1:~ # (
        # create conda volume
        vg="vg"
        data_name="data"
        conda_name="conda"
        conda_size="20"
        conda_size_unit="GiB"
        conda_size_suffix=${conda_size_unit:0:1}
        part="/dev/mapper/${vg}-${data_name}"
        umount ${part}
        e2fsck -f ${part}
        curr_size_full=$(lvdisplay ${part} | grep 'LV Size' | awk '{print $3 " " $4}')
        curr_size=$(echo ${curr_size_full} | cut -d" " -f1)
        curr_size_unit=$(echo ${curr_size_full} | cut -d" " -f2)
        [ ${curr_size_unit} == ${conda_size_unit} ] || exit ]
        new_size=$(expr $(printf "%.0f" ${curr_size}) - ${conda_size})
        resize2fs ${part} ${new_size}${conda_size_unit:0:1}
        lvresize -L${new_size}${conda_size_suffix} ${part}
        e2fsck -f ${part}
        mount ${part}
      
        free_size_full=$(vgdisplay ${vg} | 
                             grep 'Free \+PE / Size' | awk '{print $7 " " $8}')
        free_size=$(echo ${free_size_full} | cut -d" " -f1)
        free_size_unit=$(echo ${free_size_full} | cut -d" " -f2)
        [ ${free_size_unit} == ${conda_size_unit} ] || exit ]
        size_opt="-L ${conda_size}${conda_size_suffix}"
        [ $(printf "%.0f" ${free_size}) -eq ${conda_size} ] && \
          size_opt="-l 100%FREE"
        lvcreate -n ${conda_name} ${size_opt} ${vg}
        part="/dev/mapper/${vg}-${conda_name}"
        mkfs.ext4 ${part}
        part_dir="/opt/bliss/conda"
        mkdir -p ${part_dir}
        echo "${part} ${part_dir} ext4 relatime,nodev,nosuid 0 2" >> /etc/fstab
        mount ${part_dir}
        chown blissadm:bliss ${part_dir} 
    )

327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
Network performance
~~~~~~~~~~~~~~~~~~~

Add *opid00* user:

::

    # as root
    lid10eiger1:~ # mkuser opid00
    ...

Create *netperf* group and add affected users to it:

::

    lid10eiger1:~ # groupadd netperf

    lid10eiger1:~ # for u in ahoms opid00 opid10; do \
        usermod -a -G netperf ${u}; \
    done

Allow *netperf* users to set real-time (SCHED_RR) scheduling policy with
the highest priority:

::

353
    lid10eiger1:~ # cat > /etc/security/limits.d/net-performance.conf <<'EOF'
354
    @netperf         -       rtprio 99
355
    EOF
356

357
Compile the *netdev_set_queue_cpu_affinity* util, used by the *SlsDetector* plugin
358
359
360
361
362
to change the network packet dispatching tasks' CPU affinity, and install it 
in */usr/local/bin*:

::

363
364
365
366
    lid10eiger1:~ # (
        cd /tmp
        prog_name="netdev_set_queue_cpu_affinity"
        cat > ${prog_name}.c <<'EOF'
367
368
369
370
371
372
373
374
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <errno.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
375
    
376
377
    int main(int argc, char *argv[])
    {
378
379
            char *dev, *irq_queue, *p, fname[256], buffer[128];
            int irq, rps, fd, len, ret;
380
            long aff;
381
382
    
            if (argc != 5)
383
                    exit(1);
384
385
386
            irq = (strcmp(argv[1], "-i") == 0);
            rps = (strcmp(argv[1], "-r") == 0);
            if (!irq && !rps)
387
                    exit(2);
388
389
390
391
392
393
            if (!strlen(argv[2]) || !strlen(argv[3]) || !strlen(argv[4]))
                    exit(2);
    
            dev = argv[2];
            irq_queue = argv[3];
    
394
            errno = 0;
395
            aff = strtol(argv[4], &p, 0);
396
397
            if (errno || *p)
                    exit(3);
398
    
399
            len = sizeof(fname);
400
401
402
403
404
405
            if (irq)
                    ret = snprintf(fname, len, "/proc/irq/%s/smp_affinity",
                                   irq_queue);
            else
                    ret = snprintf(fname, len, "/sys/class/net/%s/queues/%s/rps_cpus",
                                   dev, irq_queue);
406
407
            if ((ret < 0) || (ret == len))
                    exit(4);
408
    
409
410
411
412
            len = sizeof(buffer);
            ret = snprintf(buffer, len, "%016lx", aff);
            if ((ret < 0) || (ret == len))
                    exit(5);
413
    
414
415
416
            fd = open(fname, O_WRONLY);
            if (fd < 0)
                    exit(6);
417
    
418
419
420
            for (p = buffer; *p; p += ret)
                    if ((ret = write(fd, p, strlen(p))) < 0)
                            exit(7);
421
    
422
423
424
425
            if (close(fd) < 0)
                    exit(8);
            return 0;
    }
426
    EOF
427

428
429
430
431
        gcc -Wall -o ${prog_name} ${prog_name}.c
        rm -f ${prog_name}.c
        mv ${prog_name} /usr/local/bin
    )
432
433

Allow *netperf* users to execute *sudo* in order to change other tasks' CPU affinity
434
435
(*taskset* and *netdev_set_queue_cpu_affinity*), to configure the network devices (*ethtool* and
*ifconfig*) and start/stop system services like *irqbalance* (*service*):
436
437
438

::

439
    lid10eiger1:~ # cat > /etc/sudoers.d/netperf <<'EOF'
440
441
    %netperf        ALL=(root) NOPASSWD: /usr/bin/taskset, /sbin/ethtool, \
                                         /sbin/ifconfig, \
442
443
444
                                         /usr/local/bin/netdev_set_queue_cpu_affinity, \
                                         /usr/sbin/service
    EOF
445
446
447
448
449

Tune the OS network buffer sizes:

::

450
    lid10eiger1:~ # cat > /etc/sysctl.d/net-performance.conf <<'EOF'
451
    # Tune network buffers for UDP RX performance
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469

    # Original values: sysctl -a | grep net
    #...
    #net.core.wmem_max = 131071
    #net.core.rmem_max = 131071
    #net.core.wmem_default = 229376
    #net.core.rmem_default = 229376
    #...
    #net.core.netdev_max_backlog = 1000
    #...
    #net.ipv4.tcp_mem = 1549845 2066462 3099690
    #net.ipv4.tcp_wmem = 4096   16384   4194304
    #net.ipv4.tcp_rmem = 4096   87380   6291456
    #...
    #net.ipv4.udp_mem = 1549845 2066462 3099690
    #net.ipv4.udp_rmem_min = 4096
    #net.ipv4.udp_wmem_min = 4096

470
    # Max OS socket receive buffer size (in bytes) for all types
471
472
    net.core.rmem_max = 134217728

473
    # Size of per-device buffer (in packets) before Linux kernel dispatching
474
    net.core.netdev_max_backlog = 262144
475
    EOF
476

477
478
*cmake* & *libnuma-dev*
~~~~~~~~~~~~~~~~~~~~~~~
479

480
481
*Conda* includes *cmake*, needed to compile Lima. De-install the Debian 7 package,
if present, or the manually installed *cmake-3.8.0*:
482
483
484
485
486
487
488
489

::

    # as root
    lid10eiger1:~ # p=$(dpkg --list cmake\* | grep '^ii' | awk '{print $2}'); \
        [ -n "${p}" ] && dpkg --purge ${p}
    ...

490
491
492
    lid10eiger1:~ # \
        curr_cmake=$(which cmake)
        if [ -n "${curr_cmake}" ] && [ $(dirname ${curr_cmake}) == "/usr/local/bin" ]; then
493
            cmake_src=$(find ~ ~opid00 -type d -name cmake-3.8.0)
494
495
            [ -n "${cmake_src}" ] && cd ${cmake_src} && su -c "make uninstall"
        fi
496
497
    ...

498
499
500
501
502
503
504
505
506
The same applies to *libnuma-dev*:

::

    # as root
    lid10eiger1:~ # p=$(dpkg --list libnuma-dev | grep '^ii' | awk '{print $2}'); \
        [ -n "${p}" ] && dpkg --purge ${p}
    ...

507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
*Xsession*
~~~~~~~~~~

*Xsession* executes *ssh-agent*, which has the *setgid* bit set. This forces
*Linux* to clear its *LD_LIBRARY_PATH*, and hence that of its descendant processes -
the full *X11* session. The following patch propagates the *LD_LIBRARY_PATH*
configured at login (*.bash_profile*) to the *X11* session:

::

    # as root
    lid10eiger1:~ # (
        Xsession_patch="/etc/X11/Xsession.d/80ld_library_path"
        [ -f ${Xsession_patch} ] || cat > ${Xsession_patch} <<'EOF'
    # This file is sourced by Xsession(5), not executed.
    
    # ensure LD_LIBRARY_PATH is propagated after ssh-agent is executed
    STARTUP="${LD_LIBRARY_PATH:+env LD_LIBRARY_PATH=$LD_LIBRARY_PATH} $STARTUP"
    
    # vim:set ai et sts=2 sw=2 tw=80:
    EOF
    )

530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
Network configuration
---------------------

Intel 10 Gigabit Converged Adapter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Interface association
^^^^^^^^^^^^^^^^^^^^^

Force *eth2* and *eth3* to be in PCI-Express slot #2 ports and *eth4*
and *eth5* to be in slot #1.

First locate the Intel 10 Gigabit X520 Ethernet adapters (reported as
*Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection*):

::

    lid10eiger1:~ # lspci | grep Ethernet
    02:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
    02:00.1 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
    05:00.0 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
    05:00.1 Ethernet controller: Intel Corporation 82599EB 10-Gigabit SFI/SFP+ Network Connection (rev 01)
    07:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
    07:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)

Then check the PCI tree:

::

    lid10eiger1:~ # lspci -t
    -+-[0000:ff]-+-08.0
    ...
     +-[0000:80]-+-01.0-[81]--
    ...
     +-[0000:7f]-+-08.0
    ...
     \-[0000:00]-+-00.0
    ...
                 +-02.0-[02-03]--+-00.0
                 |               \-00.1
                 +-02.2-[04]--
                 +-03.0-[05-06]--+-00.0
                 |               \-00.1
                 +-03.2-[07-08]--+-00.0
                 |               \-00.1
    ...

577
578
From the tree we identify the parent root device of each *Intel X520
Ethernet adapter*:
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759

+--------------+--------------+
| Node         | Parent       |
+==============+==============+
| 0000:02:00.x | 0000:00:02.0 |
+--------------+--------------+
| 0000:05:00.x | 0000:00:03.0 |
+--------------+--------------+

Find the PCI-e slot from the parent root port in the CPU:

::

    lid10eiger1:~ # lspci -s 0:02.0 -vvv | grep Slot
        Capabilities: [90] Express (v2) Root Port (Slot+), MSI 00
            LnkSta: Speed 5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
                Slot #2, PowerLimit 25.000W; Interlock- NoCompl-
    lid10eiger1:~ # lspci -s 0:03.0 -vvv | grep Slot
        Capabilities: [90] Express (v2) Root Port (Slot+), MSI 00
            LnkSta: Speed 5GT/s, Width x8, TrErr- Train- SlotClk+ DLActive+ BWMgmt+ ABWMgmt-
                Slot #1, PowerLimit 25.000W; Interlock- NoCompl-

This means that:

+--------------+------+
| Adapter      | Slot |
+==============+======+
| 0000:02:00.x | 2    |
+--------------+------+
| 0000:05:00.x | 1    |
+--------------+------+

So we must force the following association:

+--------------+----------------+
| PCI-e Device | Network Device |
+==============+================+
| 0000:02:00.0 | eth2           |
+--------------+----------------+
| 0000:02:00.1 | eth3           |
+--------------+----------------+
| 0000:05:00.0 | eth4           |
+--------------+----------------+
| 0000:05:00.1 | eth5           |
+--------------+----------------+

This is obtained by the following *udev* network rules configuration:

::

    lid10eiger1:~ # cat /etc/udev/rules.d/70-persistent-net.rules
    # This file was automatically generated by the /lib/udev/write_net_rules
    # program, run by the persistent-net-generator.rules rules file.
    #
    # You can modify it, as long as you keep each rule on a single
    # line, and change only the value of the NAME= key.

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.2/0000:07:00.1 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="0c:c4:7a:bc:d0:35", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.2/0000:07:00.0 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="0c:c4:7a:bc:d0:34", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:02.0/0000:02:00.1 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:86:28:65", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:02.0/0000:02:00.0 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:86:28:64", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.1 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:86:2e:15", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"

    # PCI device 0x8086:/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0 (ixgbe)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="90:e2:ba:86:2e:14", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

Reboot and verify that the association is OK:

::

    lid10eiger1:~ # ls -l /sys/class/net/eth?/device
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth0/device -> ../../../0000:07:00.0
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth1/device -> ../../../0000:07:00.1
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth2/device -> ../../../0000:02:00.0
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth3/device -> ../../../0000:02:00.1
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth4/device -> ../../../0000:05:00.0
    lrwxrwxrwx 1 root root 0 Sep  7 21:05 /sys/class/net/eth5/device -> ../../../0000:05:00.1

IP assignments
^^^^^^^^^^^^^^

Assign the following addresses to the Eiger interfaces:

+----------------+---------------------+--------------+
| Network Device | Function            | IP Address   |
+================+=====================+==============+
| eth2           | Top-Half Control    | 192.168.11.1 |
+----------------+---------------------+--------------+
| eth3           | Top-Half Data       | 192.168.12.1 |
+----------------+---------------------+--------------+
| eth4           | Bottom-Half Control | 192.168.13.1 |
+----------------+---------------------+--------------+
| eth5           | Bottom-Half Data    | 192.168.12.1 |
+----------------+---------------------+--------------+

For the 10 Gigabit data interfaces, we force:

-  MTU 9000
-  Rx adaptive interrupt moderation cycle of 100 usecs: */sbin/ethtool
   -C ethX rx-usecs 100*
-  Rx ring buffer size of 4096 entries: */sbin/ethtool -G ethX rx 4096*

The resulting */etc/network/interfaces* file is:

::

    lid10eiger1:~ # cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp
    #   up sleep 5; /sbin/ethtool -s eth0 autoneg off speed 100 duplex full
        up sleep 5; /sbin/ethtool -s eth0 autoneg on speed 1000 duplex full

    # The secondary network interface
    auto eth1
    allow-hotplug eth1
    iface eth1 inet static
            address 192.168.1.1
            netmask 255.255.255.0

    # The 10 Gbps FO network interfaces - Top half
    auto eth2
    allow-hotplug eth2
    iface eth2 inet static
            address 192.168.11.1
            netmask 255.255.255.0
    auto eth3
    allow-hotplug eth3
    iface eth3 inet static
            address 192.168.12.1
            netmask 255.255.255.0
            mtu 9000
            up while /sbin/ethtool eth3 | grep 'Link detected' | grep -q no; do sleep 1; done; /sbin/ethtool -C eth3 rx-usecs 100; /sbin/ethtool -G eth3 rx 4096

    # The 10 Gbps FO network interfaces - Bottom half
    auto eth4
    allow-hotplug eth4
    iface eth4 inet static
            address 192.168.13.1
            netmask 255.255.255.0
    auto eth5
    allow-hotplug eth5
    iface eth5 inet static
            address 192.168.14.1
            netmask 255.255.255.0
            mtu 9000
            up while /sbin/ethtool eth5 | grep 'Link detected' | grep -q no; do sleep 1; done; /sbin/ethtool -C eth5 rx-usecs 100; /sbin/ethtool -G eth5 rx 4096

PSI/Eiger modules
~~~~~~~~~~~~~~~~~

Define the PSI/Eiger module IPs (data interfaces are not actually
needed):

::

    lid10eiger1:~ # cat /etc/hosts
    #============= OS ====================
    127.0.0.1   localhost
    127.0.1.1   lid10eiger1.esrf.fr lid10eiger1

    #============= Eiger ====================
    # Direct Connection - Top half
    192.168.11.10   beb021.esrf.fr  beb021
760
    #192.168.12.20  beb02110ge1.esrf.fr     beb02110ge1
761
762
763

    # Direct Connection - Bottom half
    192.168.13.11   beb020.esrf.fr  beb020
764
    #192.168.14.21  beb02010ge1.esrf.fr     beb02010ge1
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882

    #============= OS ====================
    # The following lines are desirable for IPv6 capable hosts
    ::1     localhost ip6-localhost ip6-loopback
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

Modify *nsswitch.conf* to first look at */etc/hosts* when resolving
names:

::

    lid10eiger1:~ # cat /etc/nsswitch.conf
    # /etc/nsswitch.conf
    ...
    hosts:          files dns [NOTFOUND=return] mdns4_minimal mdns4
    ...

DHCP configuration
~~~~~~~~~~~~~~~~~~

Install *DHCP server* software:

::

    # as root
    lid10eiger1:~ # apt-get install isc-dhcp-server
    ...
    [FAIL] Starting ISC DHCP server: dhcpd[....] check syslog for diagnostics. ... failed!
     failed!
    invoke-rc.d: initscript isc-dhcp-server, action "start" failed.
    ldegjfrau1:~ # apt-get install isc-dhcp-server
    ...

Define the dynamic addresses and Eiger MAC/name relations:

::

    lid10eiger1:~ # cat /etc/dhcp/dhcpd.conf
    ...
    option domain-name "esrf.fr";
    option domain-name-servers dns1.esrf.fr, dns2.esrf.fr;
    ...
    # This is a very basic subnet declaration.

    subnet 192.168.1.0 netmask 255.255.255.0 {
      range 192.168.1.128 192.168.1.191;
    }

    subnet 192.168.11.0 netmask 255.255.255.0 {
      range 192.168.11.128 192.168.11.191;
    }

    subnet 192.168.12.0 netmask 255.255.255.0 {
      range 192.168.12.128 192.168.12.191;
    }

    subnet 192.168.13.0 netmask 255.255.255.0 {
      range 192.168.13.128 192.168.13.191;
    }

    subnet 192.168.14.0 netmask 255.255.255.0 {
      range 192.168.14.128 192.168.14.191;
    }

    # PSI Eiger 500k detectors

    host beb021 {
      hardware ethernet 00:50:c2:46:d9:2a;
      fixed-address beb021.esrf.fr;
    }

    host beb020 {
      hardware ethernet 00:50:c2:46:d9:28;
      fixed-address beb020.esrf.fr;
    }
    ...

Specify the interfaces *DHCP server* will listen on:

::

    lid10eiger1:~ # cat /etc/default/isc-dhcp-server
    ...
    INTERFACES="eth2 eth4"

Reboot the computer for the changes to be applied. Verify that the
*dhcp* server is running on the given interfaces:

::

    lid10eiger1:~ # ps -ef | grep dhcpd | grep -v grep
    root      3923     1  0 21:48 ?        00:00:00 /usr/sbin/dhcpd -q -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid eth2 eth4

Restart the detector, wait for 20 sec and check that the links are OK:

::

    lid10eiger1:~ # for i in $(seq 2 5); do n="eth${i}"; ifconfig ${n} | grep UP; done
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              UP BROADCAST RUNNING MULTICAST  MTU:9000  Metric:1

    lid10eiger1:~ # ping -c 1 beb021; ping -c 1 beb020
    PING beb021.esrf.fr (192.168.11.10) 56(84) bytes of data.
    64 bytes from beb021.esrf.fr (192.168.11.10): icmp_req=1 ttl=64 time=0.357 ms

    --- beb021.esrf.fr ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 0.357/0.357/0.357/0.000 ms
    PING beb020.esrf.fr (192.168.13.11) 56(84) bytes of data.
    64 bytes from beb020.esrf.fr (192.168.13.11): icmp_req=1 ttl=64 time=0.399 ms

    --- beb020.esrf.fr ping statistics ---
    1 packets transmitted, 1 received, 0% packet loss, time 0ms
    rtt min/avg/max/mdev = 0.399/0.399/0.399/0.000 ms

883

884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
SlsDetectors Software
---------------------

ROOT installation
~~~~~~~~~~~~~~~~~

Install development packages necessary as root:

::

    lid10eiger1:~ # apt-get install libxpm-dev libldap2-dev libmysqlclient-dev \
                                   libavahi-client-dev libavahi-compat-libdnssd-dev \
                                   libfftw3-dev graphviz-dev libxml2-dev libcfitsio3-dev
    ...

Unpack the ROOT sources on a user's directory (*~opid00*), build it (12
parallel jobs: one per core), and install on /opt/root:

::

    lid10eiger1:~/Downloads % mkdir -p ~/Downloads
    lid10eiger1:~/Downloads % cd ~/Downloads
    lid10eiger1:~/Downloads % scp lisgeiger1:Downloads/root_v5.34.34.source.tar.gz .
    root_v5.34.34.source.tar.gz                   100%   72MB  71.7MB/s   00:01
    lid10eiger1:~/Downloads % tar -xzf root_v5.34.34.source.tar.gz
    lid10eiger1:~/Downloads % mkdir rootbuild
    lid10eiger1:~/Downloads % cd rootbuild
    lid10eiger1:~/Downloads/rootbuild % cmake ~/Downloads/root
    ...
    lid10eiger1:~/Downloads/rootbuild % cmake --build . -- -j12
    ...
    lid10eiger1:~/Downloads/rootbuild % su
    Password:
    lid10eiger1:/users/opid00/Downloads/rootbuild # cmake -DCMAKE_INSTALL_PREFIX=/opt/root -P cmake_install.cmake
    ...

Include ROOT initialisation script in the global /etc/profile.d chain:

::

    lid10eiger1:~ # echo ". /opt/root/bin/thisroot.sh" > /etc/profile.d/root.sh

Qt4 environment
~~~~~~~~~~~~~~~

Do the same for Qt4:

::

    lid10eiger1:~ # echo "QTDIR=/usr/share/qt4
    export QTDIR" > /etc/profile.d/qt4.sh

Qwt development package installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Qwt development package is needed by some applications in the
*SlsDetectorsSoftware*:

::

    lid10eiger1:~ # apt-get install libqwt-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be REMOVED:
      libqwt5-qt4-dev
    The following NEW packages will be installed:
      libqwt-dev
    0 upgraded, 1 newly installed, 1 to remove and 210 not upgraded.
    Need to get 111 kB of archives.
    After this operation, 35.8 kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    ...

    lid10eiger1:~ # dpkg --list libqwt\* | grep '^ii'
    ii  libqwt-dev          6.0.0-1.2       amd64  Qt widgets library for technical applications (development)
    ii  libqwt5-doc         5.2.2-3         all    Qt widgets library for technical applications (documentation)
    ii  libqwt5-qt4         5.2.2-3         amd64  Qt4 widgets library for technical applications (runtime)
    ii  libqwt6             6.0.0-1.2       amd64  Qt widgets library for technical applications (runtime)
    ii  libqwtplot3d-qt4-0  0.2.7+svn191-7  amd64  3D plotting library based on Qt4/OpenGL (runtime)

965
Conda software installation
966
967
~~~~~~~~~~~~~~~~~~~~~~~~~~~

968
Before installing *Conda*, first stop the *BLISS daemons*:
969

970
971
972
973
974
975
::

    # as root
    lid10eiger1:~ # /users/blissadm/admin/etc/S70daemons stop

and delete the previous installation of the *BLISS pew environment*:
976
977
978
979

::

    # as blissadm
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
    lid10eiger1:~ % (
      rm -rf ${HOME}/.local/bin ${HOME}/.local/lib ${HOME}/lib
      sed -i '/\(PEW\|virtualenv\)/D' ${HOME}/local/BLISS_ENV_VAR 
      find ${HOME}/bin -type l |
          while read l; do
              t=$(readlink ${l})
              if echo ${t} | grep -q "${HOME}/.local/bin"; then
                  echo "Deleting ${l} -> ${t}"
                  rm -f ${l}
              fi
          done
      )
    Deleting /users/blissadm/bin/virtualenv-clone -> /users/blissadm/.local/bin/virtualenv-clone
    Deleting /users/blissadm/bin/virtualenv -> /users/blissadm/.local/bin/virtualenv
    Deleting /users/blissadm/bin/pythonz -> /users/blissadm/.local/bin/pythonz
    Deleting /users/blissadm/bin/pythonz_install -> /users/blissadm/.local/bin/pythonz_install
    Deleting /users/blissadm/bin/pew -> /users/blissadm/.local/bin/pew

Download and install *conda*:
999

1000
::