Reserve Memory for Applications on an Intel® Xeon Phi™ Coprocessor

In order to run a native program on the Intel® Xeon Phi™ coprocessor, the program and any dependencies must be copied to the target platform. However, this approach takes away memory from the native application. To reserve memory resource (16-GB GDDR5 memory on board the Intel Xeon Phi coprocessor), it is practical to mount a Network File System (NFS) shared directory on the Intel Xeon Phi coprocessor from the host server so that most of its memory can be used for applications. This article shows two ways to accomplish this task: the preferred method is using micctrl utility and the second method is a manual procedure.

Using micctrl utility

The preferred method to mount a shared directory on an Intel Xeon Phi coprocessor is to use the micctrl utility shipped with the Intel® Manycore Platform Software Stack (Intel® MPSS). The following example shows how to share the Intel® Compiler C++ library using micctrl. In the host machine used for this example, the MPSS 3.4.8 was installed.

  1. On the host machine, ensure that the shared directory exists:
    [host ~]# ls /opt/intel/compilers_and_libraries_2017.0.098/linux/
  2. Add a new descriptor to the /etc/exports configuration file in the host machine, in order to export the directory /var/mpss/mic0.exports to the coprocessor mic0 whose IP address is 172.31.1.1. Use the option read only so that the coprocessor cannot delete anything in the shared library mistakenly:
    [host ~]# cat /etc/exports
    	/opt/intel/compilers_and_libraries_2017.0.098/linux172.31.1.1(ro,async,no_root_squash)

    For more information on the export options, you can refer to http://nfs.sourceforge.net/nfs-howto/ar01s03.html.
     
  3. Next, update the NFS export table in the host:
    [host ~]# exportfs -a
  4. From the host, use the micctrl utility to add an NFS entry on the coprocessors:
    [host ~]# micctrl --addnfs=/opt/intel/compilers_and_libraries_2017.0.098/linux --dir=/mnt-library --options=defaults
  5. Restart the MPSS service:
    [host ~]# service mpss restart
    	Shutting down Intel(R) MPSS:                               [  OK  ]
    	Starting Intel(R) MPSS:                                    [  OK  ]
    	mic0: online (mode: linux image: /usr/share/mpss/boot/bzImage-knightscorner)
    	mic1: online (mode: linux image: /usr/share/mpss/boot/bzImage-knightscorner)
  6. Finally, from the coprocessor, verify that the remote directory is accessible:
    [host ~]# ssh mic0 cat /etc/fstab
    	rootfs          /               auto            defaults                1  1
    	proc            /proc           proc            defaults                0  0
    	devpts          /dev/pts        devpts          mode=0620,gid=5         0  0
    	172.31.1.254:/opt/intel/compilers_and_libraries_2017.0.098/linux  /mnt-library  nfs             defaults 1 1
    
    	[host ~]# ssh mic0 ls /mnt-mic0

Mounting manually

As an example of the manual procedure, let’s assume we want to mount an NFS shared directory /mnt-mic0 on the Intel Xeon Phi coprocessor from the host machine (/var/mpss/mic0.export is the directory that the host machine exports). In this method, steps 1-3 are the same as in the previous method:

  1. On the host machine, ensure that the shared directory exists; if doesn’t exist, create it:
    [host ~]# mkdir /var/mpss/mic0.export
  2. Add a descriptor to the /etc/exports configuration file in the host machine to export the directory /var/mpss/mic0.exports to the coprocessor mic0, which in this case has an IP address of 172.31.1.1:
    [host ~]# cat /etc/exports
    	/var/mpss/mic0.export 172.31.1.1(rw,async,no_root_squash)

    For more information on the export options, you can refer to http://nfs.sourceforge.net/nfs-howto/ar01s03.html.
     
  3. Next, update the NFS export table:
    [host ~]# exportfs -a
  4. Next, login on the coprocessor mic0:
    [host ~]# ssh mic0
  5. Create the mount point /mnt-mic0 on the coprocessor:
    (mic0)# mkdir /mnt-mic0
  6. Add the following descriptor to the /etc/fstab file of the coprocessor to specify the server, the path name of the exported directory, the local directory (mount point), the type of the file system, and the list of mount options: “172.31.1.254:/var/mpss/mic0.export /mnt-mic0 nfs defaults 1 1
    (mic0)# cat /etc/fstab
    	rootfs          /               auto             defaults                1  1
    	proc            /proc           proc             defaults                0  0
    	devpts          /dev/pts        devpts           mode=0620,gid=5         0  0
    	172.31.1.254:/var/mpss/mic0.export /mnt-mic0 nfs defaults                1  1
    	
  7. To mount the shared directory /var/mpss/mic0.export on the coprocessor, we can type:
    (mic0)# mount –a

Notes:

  • If "Connection refused" error is received, restart NFS server in the host:
    [host~]# service nfs restart
    Shutting down NFS daemon:                                  [  OK  ]
    Shutting down NFS mountd:                                  [  OK  ]
    Shutting down NFS quotas:                                  [  OK  ]
    Shutting down NFS services:                                [  OK  ]
    Starting NFS services:                                     [  OK  ]
    Starting NFS quotas:                                       [  OK  ]
    Starting NFS mountd:                                       [  OK  ]
    Stopping RPC idmapd:                                       [  OK  ]
    Starting RPC idmapd:                                       [  OK  ]
    Starting NFS daemon:                                       [  OK  ]
  • If "Permission denied" error is received, review and correct the /etc/exports file in the host.
  • If the coprocessor reboots, you have to mount the directory in the coprocessor again.
  • The above shared directory can be read/write. To change to read only option, use the option (ro,async,no_root_squash) as seen in step 2.

Conclusion

This article shows two methods to mount a shared directory on the Intel Xeon Phi coprocessor. One method is using micctrl utility, the other is the common manual method. Although both methods work, using micctrl utility is the preferred method as it prevents users from entering data incorrectly in the /etc/fstab table of the coprocessor.

References

For more complete information about compiler optimizations, see our Optimization Notice.