Working with RDMA in Ubuntu
Ubuntu has integrated RDMA support. In This post we'll discuss how to manage and work with the inbox RDMA packages in this distribution.
Installing RDMA packages
One can install all the RDMA packages manually one by one and resolve the dependency by himself. However, apt-get provides us an easy way to install all the needed packages for working with RDMA and resolve the dependencies in other packages automatically.
The following command line will install the needed packages that are needed to work with RDMA:
Note: In different versions of the Ubuntu distributions, some packages may not be available. For example: in Ubuntu 14.10 the following packages are unavailable anymore: libdapl2, rds-tools and libibcommon1. Trying to install them will lead to an error.
Uninstalling RDMA packages
Just like we used apt-get install the packages group, we'll use it to uninstall those packages, if they aren't needed anymore. The following command line will uninstall the RDMA packages:
Starting the RDMA services
In Ubuntu there isn't any service file to load and unload the RDMA drivers; this needs to be done manually. Load the RDMA drivers using the following command line(s):
If one is using the InfiniBand transport and he doesn't have a managed switch in the subnet, he has to start the Subnet Manager (SM). Doing this in one of the machines in the subnet is enough, this can be done with the following command line:
Stopping the RDMA services
If the SM is running, then it must be stopped before unloading the drivers. Stop the SM using the following command line(s):
Unload the RDMA drivers using the following command line:
RDMA configuration file(s)
1. If the file /etc/udev/rules.d/40-rdma.rules doesn't exist, create it with the following content:
2. RDMA needs to work with pinned memory, i.e. memory which cannot be swapped out by the kernel. By default, every process that is running as a non-root user is allowed to pin a low amount of memory (64KB). In order to work properly as a non-root user, it is highly recommended to increase the size of memory which can be locked. Edit the file /etc/security/limits.conf and add the following lines:
* soft memlock unlimited
* hard memlock unlimited
root soft memlock unlimited
root hard memlock unlimited
This will allow process that is running as any user to pin unlimited amount of memory. Changing this line will become effective for new login sessions.
After login again, executing the following command line will print how much memory (in KB) can be locked:
(the expected output is: "unlimited").
If one wishes to allow better control on this configuration: e.g. less memory to be pinned, or allow only specific user(s) to pin more memory - please refer to the Linux distribution manual.
Tell us what do you think.