Skip to content

Setup Dev Environment (Linux)

Aditya Chinchure edited this page Jun 23, 2020 · 1 revision

Getting Started

Before getting Leap installed you need to have Python 3.7 and Golang 1.10 installed. A good guide on how to get Golang up and running can be found here. For Python, you can use a distribution such as Anaconda.

Protoc compiler and runtime

First you need to install the protoc compiler and runtime. This is necessary to get protocol buffers to work. Protocol buffers are used to serialize and deserialize the data transmitted through Leap. The protoc compiler and runtime can be installed by executing the commands below in your terminal.

Install some tools to build protobuf from source:

sudo apt-get install autoconf automake libtool curl make g++ unzip

Now clone the protobuf repository into a directory of your choice. In this example, the home directory is used. We will also clone the submodules and generate the configure script.

cd
git clone https://github.com/protocolbuffers/protobuf.git 
cd protobuf
git submodule update --init --recursive
./autogen.sh

The final step is to install the protocol buffer runtime and compiler. This may take a few minutes. If the make check fails, you can still install, but some features of the library may not work.

./configure 
make
make check
sudo make install
sudo ldconfig # refresh shared library cache.

The compiler plugin for Go will be installed in $GOPATH/bin. Unless you have already set your $GOBIN, you must add $GOPATH/bin to your $PATH for the protocol compiler to find it. To do this, open ~/.bashrc and add the following line to your .bashrc:

export PATH=$PATH:$GOPATH/bin

Cloning LEAP

The next step is to clone the LEAP repository in your computer. You can do this by navigating to your GOPATH and running git clone https://github.com/bestchai/leap.gitin the terminal.

Go packages

We need to install the packages used by our Go programs. To install the packages, run the following commands in your terminal:

go get -u github.com/golang/protobuf/protoc-gen-go
go get -u google.golang.org/grpc
go get -u github.com/sirupsen/logrus
go get -u github.com/rifflock/lfshook
go get -u golang.org/x/crypto/bcrypt
go get -u github.com/dgrijalva/jwt-go

Python packages

We also need to install the necessary python packages. The packages to be installed are below:

pip install pandas 
pip install protobuf 
pip install grpcio 
pip install grpcio-tools
pip install requests
pip install -e git+https://github.com/sburns/PyCap.git#egg=PyCap
pip install numpy
pip install pylogrus
pip install torch

Installing MySQL

Make sure to have gcc installed in your machine because go-sqlite3 is a cgo package. Installing go-sqlite3 requires gcc, but after initial installation leap can run without relying on gcc.

go get github.com/mattn/go-sqlite3
go install github.com/mattn/go-sqlite3
export CGO_ENABLED=1

Running LEAP

The leap infrastructure is composed of 4 different programs: the site-algo, the site-connector, the coordinator, and the cloud-algo. Once these 4 programs are up and running, you can use the Leap API to perform some computations.

Before starting the 4 different programs go to the main leap directory and run the following command to compile the proto files:

bash compileProtos.sh

Starting the Coordinator

The coordinator is what holds the system together. It talks to the site-connector and the cloud-algo. To start the coordinator go to the exe directory and run the following command:

go run coordinator-main.go -config=../config/coord-config.json

config: The path to the config file of the coordinator.

Starting the Site Connector

The site connector is the point of contact between each hospital site and the coordinator. To run the site connector go to the exe directory and execute the following command:

go run connector-main.go -config=../config/conn-config.json

config: The path to the config file of the site-connector.

Starting the Site Algo

The site algo has access to a dataset and runs computations relayed to it. It responds to requests from the site-connector, which passes the results from the site-algo to the coordinator. Inside the exe directory, type the following command:

python -m sitealgo_main -config=../config/sitealgo_config.json

config: The path to the config file of the site algo.

Starting the Cloud Algo

The cloud algo receives the results from all the sites through the coordinator. It then performs some computation using these results. To run the cloud algo, navigate to the exe directory and enter the following command:

python -m cloudalgo_main -config=../config/cloudalgo_config.json

config: The path to the config file of the cloud algo.

To learn how to configure your LEAP system, visit Configure LEAP