CNS: Cortical Network Simulator
 Programming Guide

Installation


Note: CNS is designed to run on a GPU, but can also run without one (much more slowly). These instructions are written assuming you have a GPU. If you don't, skip any steps written in italics and also read this section.



Requirements

Recently Tested Configurations

Linux: Windows:

Preparing Your Computer

  1. Make sure MATLAB's "mex" command can find your C++ compiler. You can set this up in MATLAB with the command "mex -setup".

  2. Make sure the CUDA driver and CUDA toolkit (both version 4.1 or 5.0) are installed. If you need to install them, install the driver first. Note that CNS does not require the CUDA SDK.

  3. (Linux only.) Consider setting your GPU(s) to "exclusive access" mode to ensure that they will only allow one model at a time to run. Usually, trying to run multiple models on one GPU results in out-of-GPU-memory errors. Setting exclusive access avoids this. In multi-GPU systems, this setting also allows CNS to automatically select a GPU that isn't being used. Under other operating systems, GPU selection must currently be managed manually. See the NVIDIA documentation for how to specify exclusive access under Linux.

  4. (Linux or Mac only.) Make sure you have the C shell installed.

  5. Make sure that on operating system startup:

  6. (Linux or Mac only.) Make sure that on operating system startup:


Installing Core CNS

  1. Unpack the archive file and move the "cns" directory to wherever you will be using it.

  2. Make sure the settings in one of these files (the one corresponding to your OS) are correct for your computer:
    cns/scripts/linux/setup
    cns/scripts/win/setup.bat
    cns/scripts/mac/setup
    
  3. (Linux or Mac only.) Make sure the following permissions are set:

  4. Make sure the "cns" directory and its subdirectories will be in your MATLAB path on startup. One way to do this is to call "cns/cns_path.m" from your "startup.m" file.

  5. (In MATLAB.) Create binaries by running:
    cns_install
  6. (In MATLAB.) Compile the demo package using the command:
    cns_build demopkg
  7. (In MATLAB.) Run the demo package by typing "demopkg_run". If everything is working, MATLAB should output the following messages:
    Defining a network model....
    Building the model (platform: GPU)....
    Reading a test image and loading it into the model....
    Running the model and retrieving result....
    Elapsed time is ??? seconds.
    Plotting result....
    Releasing model resources....
    
    and you should also see the following figure:

Installing Packages

Perform the following instructions for any packages you intend to use with CNS.
  1. Unpack the archive file and move the package directory to where you will be using it.

  2. (Linux or Mac only.) Make sure permissions are set so that it is possible to create new files in the package directory.

  3. Make sure the package directory and any subdirectories are in your MATLAB path.

  4. Compile the package using the command "cns_build package", where package is the package name. Normally this will be the same as the directory name. All file names in the package directory also start with the package name.
Note: if you change anything in a package directory, you must re-run the above cns_build command.


Running Without a GPU

If you need to run CNS without a GPU, do the following.