====== Installation d'un Xeon Phi sous Debian Wheezy ======
===== Introduction =====
La société Intel a mis à disposition fin 2013 des Intel Xeon Phi de manière à évaluer leurs performances en OpenCL. Les
===== Installation =====
==== Détection du périphérique ====
Il est supposé que le système hôte est une Debian Wheezy standard, sur une architecture AMD64. Le socle présenté ici était un Intel Grizzly disposant 7120. De manière à ne pas toucher au matériel embarqué et polluer le disque dur de la machine, l'équipement démarre par PXE et monte un disque par iSCSI.
La Debian Wheezy disposait d'un noyau 3.2 version 54 (maintenant 57). Un ''lspsi'' offrait pour ce matériel la sortie suivante :
08:00.0 Co-processor: Intel Corporation Device 225c (rev 11)
Le composant MIC n'est donc pas intégré à la liste de périphériques PCI reconnus. La commande @update-pciids@ permet de mettre cette base à jour. Un nouveau lancement de ''lspci | grep -i phi'' offre la sortie suivante :
08:00.0 Co-processor: Intel Corporation Xeon Phi coprocessor SE10/7120 series (rev 11)
==== Création des paquets Intel ====
Les composants fournis par Intel sont présents sur le site Intel MPSS pour Manycore Platform Software Stack
Il n'existe que les paquets pour quelques distributions RedHat ou dérivées : récupération de la dernière version RedHat
wget http://registrationcenter.intel.com/irc_nas/3778/mpss-3.1.2-rhel-6.5.tar
La documentation [[http://registrationcenter.intel.com/irc_nas/3778/MPSS_Users_Guide.pdf|MPSS User Guide]]
est indispensable pour commencer.
==== Préparation du système ====
* Installation de quoi transformer les paquets RPM en DEBapt-get install alien
* Installation de qui construire des paquets Debian :apt-get install pbuilder
* Installation de quoi compiler un module noyau : apt-get install kernel-package
==== Transformation des paquets RPM en DEB ====
tar xvf mpss-3.1.2-rhel-6.5.tar
cd mpss-3.1.2
ls *.rpm | xargs -I '{}' alien --scripts '{}'
La liste des paquets crés est la suivante :
glibc2.12.2pkg-libmicaccesssdk0_3.1.2-2_amd64.deb
glibc2.12.2pkg-libmicaccesssdk-dev_3.1.2-2_amd64.deb
glibc2.12.2pkg-libmicaccesssdk-doc_3.1.2-2_amd64.deb
glibc2.12.2pkg-libmicmgmt0_3.1.2-2_amd64.deb
glibc2.12.2pkg-libmicmgmt-dev_3.1.2-2_amd64.deb
glibc2.12.2pkg-libmicmgmt-doc_3.1.2-2_amd64.deb
glibc2.12.2pkg-libodmdebug0_3.1.2-2_amd64.deb
glibc2.12.2pkg-libodmdebug-dev_3.1.2-2_amd64.deb
glibc2.12.2pkg-libsettings0_3.1.2-2_amd64.deb
glibc2.12.2pkg-libsettings-dev_3.1.2-2_amd64.deb
intel-composerxe-compat-k1om_3.1.2-2_amd64.deb
libscif0_3.1.2-2_amd64.deb
libscif-dev_3.1.2-2_amd64.deb
libscif-doc_3.1.2-2_amd64.deb
mpss-boot-files_3.1.2-2_amd64.deb
mpss-coi_3.1.2-2_amd64.deb
mpss-coi-dev_3.1.2-2_amd64.deb
mpss-coi-doc_3.1.2-2_amd64.deb
mpss-daemon_3.1.2-2_amd64.deb
mpss-daemon-dev_3.1.2-2_amd64.deb
mpss-eclipse-cdt-mpm_3.1.2-2_amd64.deb
mpss-flash_3.1.2-2_amd64.deb
mpss-license_3.1.2-2_amd64.deb
mpss-metadata_3.1.2-2_amd64.deb
mpss-metadata-dev_3.1.2-2_amd64.deb
mpss-miccheck_3.1.2-1_amd64.deb
mpss-miccheck-bin_3.1.2-1_amd64.deb
mpss-micmgmt_3.1.2-2_amd64.deb
mpss-micmgmt-doc_3.1.2-2_amd64.deb
mpss-micmgmt-python_3.1.2-2_amd64.deb
mpss-modules-2.6.32-431.el6.x86-64_3.1.2-2_amd64.deb
mpss-modules-dev-2.6.32-431.el6.x86-64_3.1.2-2_amd64.deb
mpss-modules-headers_3.1.2-2_amd64.deb
mpss-modules-headers-dev_3.1.2-2_amd64.deb
mpss-mpm_3.1.2-2_amd64.deb
mpss-mpm-doc_3.1.2-2_amd64.deb
mpss-myo_3.1.2-2_amd64.deb
mpss-myo-dev_3.1.2-2_amd64.deb
mpss-myo-doc_3.1.2-2_amd64.deb
mpss-rasmm-kernel_3.1.2-2_amd64.deb
mpss-sciftutorials_3.1.2-2_amd64.deb
mpss-sciftutorials-doc_3.1.2-2_amd64.deb
mpss-sdk-k1om_3.1.2-2_amd64.deb
mpss-sysmgmt-micras_3.1.2-2_amd64.deb
mpss-sysmgmt-micsmc-gui_3.1.2-2_amd64.deb
mpss-sysmgmt-python_3.1.2-2_amd64.deb
==== Compilation du module noyau ====
Il n'est pas possible de directement créer le module MIC sans modifier le code source. En effet, les fichiers suivants doivent être modifiés pour compiler sur un noyau 3.2 Debian.host/linvnet.c
host/pm_ioctl.c
micscif/micscif_debug.c
micscif/micscif_rb.c
vnet/micveth_dma.c
Voici les opérations nécessaires poir compiler le module associé au noyau :
mkdir mpss-modules
cd mpss-modules
rpm2cpio ../src/mpss-modules-3.1.2-1.el6.src.rpm | cpio -idmv
tar jxf mpss-modules-3.1.2.tar.bz2
wget http://www.cbp.ens-lyon.fr/emmanuel.quemener/software/XeonPhi/PatchDebianWheezyMPSS312.patch
patch -p 1 -i ./PatchDebianWheezyMPSS312.patch
export INSTALL_MOD_PATH=/lib/modules/$(uname -r)/extra
export MIC_CARD_ARCH=k1om
make
make install
depmod -a
==== Chargement du module MIC ====
Chargement du module par la commande ''modprobe mic''
Dans le ''dmesg'' on obtient :
[ 5486.230236] vnet: mode: dma, buffers: 62
[ 5486.230446] mic 0000:08:00.0: setting latency timer to 64
[ 5486.230662] mic 0000:08:00.0: irq 145 for MSI/MSI-X
[ 5486.230701] mic0: Transition from state ready to resetting
[ 5496.148217] sched: RT throttling activated
[ 5496.150412] mic_probe 8:0:0 as board #0
[ 5496.150545] mic: number of devices detected 1
[ 5497.148253] mic0: Resetting (Post Code 12)
[ 5497.148272] mic0: Transition from state resetting to ready
[ 5497.148320] My Phys addrs: 0x87cba60000 and scif_addr 0x8818b192c0
En tapant ''ip link show'' on obtient :
1: lo: mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
link/ether 00:1e:67:7f:e4:eb brd ff:ff:ff:ff:ff:ff
3: eth1: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether 00:1e:67:7f:e4:ec brd ff:ff:ff:ff:ff:ff
4: eth2: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether 00:1e:67:7f:e4:ed brd ff:ff:ff:ff:ff:ff
5: eth3: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether 00:1e:67:7f:e4:ee brd ff:ff:ff:ff:ff:ff
7: mic0: mtu 64512 qdisc noop state DOWN mode DEFAULT qlen 1000
link/ether 4c:79:ba:32:0f:71 brd ff:ff:ff:ff:ff:ff
Copie du paramétrage pour le module MIC chargé au démarrage
cp /root/mpss-3.1.2/mpss-modules/mic.conf /etc/modprobe.d
update-initramfs -k all -u
==== Installation des paquets MPSS ====
Les paquets MPSS d'Intel ont été transformés avec ''alien'' dans ''/root/mpss-3.1.2''
Les paquets mpss-modules sont supprimés. Les autres installés tel que.
cd /root/mpss-3.1.2
rm *mpss-modules*deb
ls *-lib*deb | xargs -I '{}' dpkg -i '{}'
ls *deb | grep -v '\-lib' | xargs -I '{}' dpkg -i '{}'
Par défaut les installations se font dans :/opt/mpss/3.1.2
/opt/intel/mic/
/etc/mpss
/usr/lib64
Ceci n'est plus le cas dans la Debian Wheezy. Il est donc nécessaire de rajouter (salement) un chemin allant chercher les librairies dans ''/usr/lib64''.
Installation d'un ''LD_LIBRARY_PATH'' sur ''/usr/lib64'' :
echo /usr/lib64 >> /etc/ld.so.conf.d/mic.conf
La commande ''mpssinfo''
MPSS : mpssinfo
MpssInfo Utility Log
Created Thu Feb 13 15:52:59 2014
System Info
HOST OS : Linux
OS Version : 3.2.0-4-amd64
Driver Version : 3.1.2-1
MPSS Version : NotAvailable
Host Physical Memory : 66010 MB
Device No: 0, Device Name: mic0
Board
Vendor ID : 0x8086
Device ID : 0x225c
Subsystem ID : 0x2500
Coprocessor Stepping ID : 3
PCIe Width : x16
PCIe Speed : 5 GT/s
PCIe Max payload size : 256 bytes
PCIe Max read req size : 4096 bytes
Coprocessor Model : 0x01
Coprocessor Model Ext : 0x00
Coprocessor Type : 0x00
Coprocessor Family : 0x0b
Coprocessor Family Ext : 0x00
Coprocessor Stepping : B1
Board SKU : B1PRQ-7110 P/X
MICCTRL : micctrl --status
mic0: ready
Pour démarrer le système sur le Xeon Phi, le démon ''mpssd'' s'attend à trouver un ''/var/lock/subsys'' pour créer un ''/var/lock/subsys/mpssd''. Voici une solution pour que, à chaque démarrage, l'opération soit réalisée :
mkdir /var/lock/subsys
sed -i "s/^exit/mkdir\ \/var\/lock\/subsys\nexit/g" /etc/rc.local
Lancement avec la commande suivante : ''micctrl \-\-initdefaults'' dont la sortie est la suivante
[Warning] mic0: Generating compat network config file. This will be removed in the 3.2 release
[Warning] mic0: User 'root' does not have either rsa or dsa keys created
micctrl --config
mic0:
=============================================================
Linux Kernel: /usr/share/mpss/boot/bzImage-knightscorner
BootOnStart: Enabled
Shutdowntimeout: 300 seconds
ExtraCommandLine: highres=off
PowerManagment cpufreq_on;corec6_on;pc3_on;pc6_on
UserAuthentication: Local
Root Device: Dynamic Ram Filesystem /var/mpss/mic0.image.gz from:
Base: /usr/share/mpss/boot/initramfs-knightscorner.cpio.gz
CommonDir: /var/mpss/common.filelist
MicDir: /var/mpss/mic0.filelist
Network: Static Pair
Hostname: grizzly-mic0
MIC IP: 172.31.1.1
Host IP: 172.31.1.254
Net Bits: 24
NetMask: 255.255.255.0
MtuSize: 64512
MIC MAC: 4c:79:ba:32:0f:70
Host MAC: 4c:79:ba:32:0f:71
Console: hvc0
VerboseLogging: Disabled
Lancement du démon avec ''mpssd''
Connaissance de d'état de la carte avec ''micctrl --status''
mic0: online (mode: linux image: /usr/share/mpss/boot/bzImage-knightscorner)
Définition de l'adresse statique de l'interface mic0 dans ''/etc/network/interfaces''
auto mic0
iface mic0 inet static
address 172.31.1.254
netmask 255.255.255.0
broadcast 172.31.1.255
network 172.31.1.0
post-up /sbin/iptables -t nat -A POSTROUTING -s 172.31.1.0/24 -o eth0 -j MASQUERADE
echo mic >> /etc/modules
update-initramfs -k all -u
Chargement de l'interface réseau avec ''ifup mic0''
Connexion sur le xeon-phi avec ''ssh 172.31.1.1''
Vérification du nombre de processeurs avec ''cat /proc/cpuinfo | grep ^processor | wc -l'' lequel donne ''244''.
==== Installation du composant OpenCL ====
=== Installation des composants OpenCL standards ===
apt-get install amd-clinfo amd-libopencl1 amd-opencl-icd
=== Vérification du fonctionnement de OpenCL avec clinfo ===
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 AMD-APP (938.2)
Platform Name: AMD Accelerated Parallel Processing
Platform Vendor: Advanced Micro Devices, Inc.
Platform Extensions: cl_khr_icd cl_amd_event_callback cl_amd_offline_devices
Platform Name: AMD Accelerated Parallel Processing
Number of devices: 1
Device Type: CL_DEVICE_TYPE_CPU
Device ID: 4098
Board name:
Max compute units: 32
Max work items dimensions: 3
Max work items[0]: 1024
Max work items[1]: 1024
Max work items[2]: 1024
Max work group size: 1024
Preferred vector width char: 16
Preferred vector width short: 8
Preferred vector width int: 4
Preferred vector width long: 2
Preferred vector width float: 4
Preferred vector width double: 0
Native vector width char: 16
Native vector width short: 8
Native vector width int: 4
Native vector width long: 2
Native vector width float: 4
Native vector width double: 0
Max clock frequency: 1200Mhz
Address bits: 64
Max memory allocation: 16898804736
Image support: Yes
Max number of images read arguments: 128
Max number of images write arguments: 8
Max image 2D width: 8192
Max image 2D height: 8192
Max image 3D width: 2048
Max image 3D height: 2048
Max image 3D depth: 2048
Max samplers within kernel: 16
Max size of kernel argument: 4096
Alignment (bits) of base address: 1024
Minimum alignment (bytes) for any datatype: 128
Single precision floating point capability
Denorms: Yes
Quiet NaNs: Yes
Round to nearest even: Yes
Round to zero: Yes
Round to +ve and infinity: Yes
IEEE754-2008 fused multiply-add: Yes
Cache type: Read/Write
Cache line size: 64
Cache size: 32768
Global memory size: 67595218944
Constant buffer size: 65536
Max number of constant args: 8
Local memory type: Global
Local memory size: 32768
Kernel Preferred work group size multiple: 1
Error correction support: 0
Unified memory for Host and Device: 1
Profiling timer resolution: 1
Device endianess: Little
Available: Yes
Compiler available: Yes
Execution capabilities:
Execute OpenCL kernels: Yes
Execute native function: Yes
Queue properties:
Out-of-Order: No
Profiling : Yes
Platform ID: 0x7f926ed1bce0
Name: Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz
Vendor: GenuineIntel
Device OpenCL C version: OpenCL C 1.2
Driver version: 2.0 (sse2,avx)
Profile: FULL_PROFILE
Version: OpenCL 1.2 AMD-APP (938.2)
Extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_popcnt
Seuls les processeurs CPU sont détectés
=== Installation des composants Python OpenCL ===
python-pyopencl python-pyopencl-doc
=== Vérification du fonctionnement ===
python /usr/share/doc/python-pyopencl-doc/examples/benchmark-all.py
('Execution time of test without OpenCL: ', 7.673499822616577, 's')
===============================================================
('Platform name:', 'AMD Accelerated Parallel Processing')
('Platform profile:', 'FULL_PROFILE')
('Platform vendor:', 'Advanced Micro Devices, Inc.')
('Platform version:', 'OpenCL 1.2 AMD-APP (938.2)')
---------------------------------------------------------------
('Device name:', 'Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz')
('Device type:', 'CPU')
('Device memory: ', 64463, 'MB')
('Device max clock speed:', 1200, 'MHz')
('Device compute units:', 32)
Execution time of test: 0.00112901 s
Results OK
root@grizzly:~# ^C
root@grizzly:~# python /usr/share/doc/python-pyopencl-doc/examples/benchmark-all.py
('Execution time of test without OpenCL: ', 7.43899393081665, 's')
===============================================================
('Platform name:', 'AMD Accelerated Parallel Processing')
('Platform profile:', 'FULL_PROFILE')
('Platform vendor:', 'Advanced Micro Devices, Inc.')
('Platform version:', 'OpenCL 1.2 AMD-APP (938.2)')
---------------------------------------------------------------
('Device name:', 'Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz')
('Device type:', 'CPU')
('Device memory: ', 64463, 'MB')
('Device max clock speed:', 1200, 'MHz')
('Device compute units:', 32)
Execution time of test: 0.000632971 s
Results OK
Intel publie ses [[http://software.intel.com/en-us/vcsource/tools/opencl-sdk-xe|versions de OpenCL]].
La dernière version est la 3.2.1.16712
==== Récupération de la dernière version : ====
cd /root
wget http://registrationcenter.intel.com/irc_nas/3809/intel_sdk_for_ocl_applications_xe_2013_r3_sdk_3.2.1.16712_x64.tgz
tar xzf intel_sdk_for_ocl_applications_xe_2013_r3_sdk_3.2.1.16712_x64.tgz
cd /root/intel_sdk_for_ocl_applications_xe_2013_r3_sdk_3.2.1.16712_x64
==== Conversion des RPM en DEB ====
ls *.rpm | xargs -I '{}' alien --scripts '{}'
opencl-1.2-base_3.2.1.16712-2_amd64.deb generated
opencl-1.2-devel_3.2.1.16712-2_amd64.deb generated
opencl-1.2-intel-cpu_3.2.1.16712-2_amd64.deb generated
opencl-1.2-intel-devel_3.2.1.16712-2_amd64.deb generated
==== Installation des paquets ====
dpkg -i *.deb
Un lien est réalisé entre ''/opt/intel/opencl-1.2-3.2.1.16712'' et '/etc/alternatives/opencl-intel-runtime'
echo /etc/alternatives/opencl-intel-runtime/lib64 >> /etc/ld.so.conf.d/mic.conf
echo /etc/alternatives/opencl-intel-runtime/libmic >> /etc/ld.so.conf.d/mic.conf
ldconfig
clinfo | grep "Device Type"
Plus besoin d'établir les liens pour l'ICD.
3 composants sont détectés :
Device Type: CL_DEVICE_TYPE_CPU
Device Type: CL_DEVICE_TYPE_CPU
Device Type: CL_DEVICE_TYPE_ACCRLERATOR
Lancement du test Python OpenCL 'python /usr/share/doc/python-pyopencl-doc/examples/benchmark-all.py' :
('Execution time of test without OpenCL: ', 7.768199920654297, 's')
===============================================================
('Platform name:', 'AMD Accelerated Parallel Processing')
('Platform profile:', 'FULL_PROFILE')
('Platform vendor:', 'Advanced Micro Devices, Inc.')
('Platform version:', 'OpenCL 1.2 AMD-APP (938.2)')
---------------------------------------------------------------
('Device name:', 'Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz')
('Device type:', 'CPU')
('Device memory: ', 64463, 'MB')
('Device max clock speed:', 1200, 'MHz')
('Device compute units:', 32)
Execution time of test: 0.000990689 s
Results OK
===============================================================
('Platform name:', 'Intel(R) OpenCL')
('Platform profile:', 'FULL_PROFILE')
('Platform vendor:', 'Intel(R) Corporation')
('Platform version:', 'OpenCL 1.2 LINUX')
---------------------------------------------------------------
('Device name:', ' Intel(R) Xeon(R) CPU E5-2680 0 @ 2.70GHz')
('Device type:', 'CPU')
('Device memory: ', 64463, 'MB')
('Device max clock speed:', 2700, 'MHz')
('Device compute units:', 32)
/usr/lib/python2.7/dist-packages/pyopencl/__init__.py:36: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
"to see more.", CompilerWarning)
Execution time of test: 0.00065297 s
Results OK
===============================================================
('Platform name:', 'Intel(R) OpenCL')
('Platform profile:', 'FULL_PROFILE')
('Platform vendor:', 'Intel(R) Corporation')
('Platform version:', 'OpenCL 1.2 LINUX')
---------------------------------------------------------------
('Device name:', 'Intel(R) Many Integrated Core Acceleration Card')
('Device type:', 'ACCELERATOR')
('Device memory: ', 5772, 'MB')
('Device max clock speed:', 1100, 'MHz')
('Device compute units:', 240)
Execution time of test: 0.00400693 s
Results OK
===== Historique =====