Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page will guide you through the process of setting up CLion for MXNet C++ development on Mac. It covers two different setups: a CLion setup for MXNet development on Mac one, where both the coding and building are done in your laptop, and a remote setup. This second option is based on a new feature in CLion v2018.3 which enables remote project support.

 A. Local setup

Anchor
local
local

Step 1. Install prerequisites

These are not required, but they are recommended practices. The next steps assume that Homebrew, the package manager manager for macOS, is installed in your device. Otherwise, it can easily be installed by running the following command:

...

Code Block
languagebash
themeMidnight
firstline1
sudo xcodebuild -license accept


Step 2. Get the MXNet codebase

Once you have installed the required tools, it is time to get the project's code. 

...

Next, set git secrets to track the repository with git secrets install. Besides, we add common AWS patterns to the configuration, ensuring that they are not present in any commit

Code Block
languagebash
themeMidnight
firstline1
cd incubator-mxnet
git secrets install
git secrets --register-aws

Once the repo is being tracked, you can add different prohibited patterns for git-secrets to control. Check the documentation for further instructions on how to add patterns, exceptions and other utilities.



Step 3. Install additional tools 
Anchor
tools
tools

Before installing CLion, there is a set of tools for compiling C++ projects which we need to install.

...

Code Block
languagebash
themeMidnight
firstline1
brew install jemalloc

Step 4. CLion

...

setup 

Start by downloading CLion from JetBrains' website and installing it.

...

Info

If you use Finder to browse for the compiler paths, use + + . to show hidden folders.


4.2. Build

...

configuration 
Anchor
setup4.2
setup4.2

  1. In the preferences window, search for CMake, under the Build, Execution, Deployment section.
  2. Add a new profile using the + button on the bottom and give it a name of your choice.
  3. Set the toolchain to the one we defined in 4.1.
  4. Define the CMake options (explained in the next step, 4.3).

...

Info

If changing the preferences does not have any effect, you may need to reset CMake's cache. To do so, go to Tools > CMake > Reset Cache and Reload Project.


4.3. Set CMake

...

options 
Anchor
setup4.3
setup4.3

The following options are used in order to be able to compile in a Mac:

...

To make sure everything is working properly, select mxnet_unit_tests as run configuration and run it. 


Step 5. Select a style file (optional)

CLion provides code generation and formatting tools which can come in handy when developing. Coding style can be defined in the preferences dialogue to have CLion stick to certain coding guidelines. These can be loaded from an external style file, and they can be applied at project level or globally, at IDE level.

...

Next, click the settings icon () on the right > Import scheme > Intellij IDEA code style XML and browse for the style file.


Image Modified








B. Remote host

Anchor
remote
remote


Since version 2018.3 (it is an experimental version as of the writing of this page), CLion will support remote projects. Using this feature, it is possible to code locally in CLion and build, run and test on your remote machine. In order for this feature to work, you need:

  • A local client machine, which can be either macOS, Windows or Linux, with CLion 2018.3 or newer.
  • A Linux host, with rsync installed (unless your local machine is running Windows, in which case tar is needed)


To setup remote host development, simply:

  1. Install the required tools (described in A.Step 3 of this guide - specific installation commands will vary, as the remote has to run Linux)  on your remote machine.
  2. Follow this tutorial from Jetbrains' website to setup a remote toolchain and configure the SSH connection, as well as the mappings (where your project will be located on the remote host).
  3. Set the appropriate CMake options. Section A.4.3 of this guide can be used s reference, although your options will depend on your remote host setup.


Info

The first time you build remotely, CLion will sync your local files with the remote host. Depending on your connection, this process might take some time. If you have previously built your project locally, make sure to run

make clean before the sync takes place, so there are less files to be copied.




Content by Label
showLabelsfalse
max5
spacesKAFKA
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("c++","mxnet","clion") and type = "page" and space = "KAFKA"
labelsc++ clion mxnet

...