Go Environment Set Up

From xx network wiki
Jump to navigation Jump to search
This is a team contributed page

Before running tests from the Elixxir codebase or xx network codebase or compiling your own binaries, a development environment must be set up with Go 1.19.3 and some additional software.

These instructions describe how to run tests in Ubuntu Server 20.04. However, almost all tests run successfully on Windows, macOS, and other Linux distributions.
  1. First, install the build-essential package, which contains several tools for compiling binaries. This step is only necessary if running tests on cMix with the GPU.

    If the GPU drivers were previously installed, build-essential might be already installed too.
  2. Download the latest version of Go version 1.19.3. Refer to the Go install page for more information.

  3. Extract the archive into /usr/local.

  4. The .profile file for the current user must be modified to include /usr/local/go/bin in the PATH environment variable. This can be done manually by opening the file and modifying it. Alternatively, use the following command to append the correct line to the .profile file automatically.

  5. Once the file is saved, to apply the changes immediately, run the following command.

  6. To ensure that everything is working and that Go is the correct version, run the following command.

    It should result in a similar output to this:

  7. Finally, create a directory to place the Go source code downloaded in the following sections. Any name can be chosen.

Set Up GPU for cMix

To get better performance when running cMix or to run specific tests, a GPU is required and the gpumathsnative repository must be downloaded. This allows operations to be done on the GPU and is where the underlying CUDA implementations of the mathematical operations live.

  1. First, set up the GPU Drivers.

  2. Next, install the CUDA Toolkit 11.2. Nvidia provides a list of commands to run that install all the necessary software onto the machine. Run all the commands in the provided order.

    Note that this process can be slow.
  3. Once the installation is complete, reboot the system.

  4. Install libgmp-de and cuda, dependencies for the GPU code to run.

  5. The .profile file for the current user must be modified to include /usr/local/cuda/bin in the PATH environment variable. This can be done manually by opening the file and modifying it. Alternatively, use the following command to append the correct line to the .profile file automatically.

  6. Once the file is saved, to apply the changes immediately, run the following command.

  7. Install the latest version of the gpumathsnative repository. This is where the underlying CUDA implementations of the mathematical operations live and allows operations to be done on the GPU.

    Running make fatbin can take a few minutes.