Skip to content

Runtime Env Setup

Mike Zhou edited this page Feb 11, 2019 · 26 revisions

When Google's TensorFlow was first released, Linux was the only platform supported. Lately, Windows support has been added and becomes quite stable. Therefore, we recommend using Windows for your research and Linux for production usage.

Windows

Upgrade

To check the current TensorFlow version:

    c:>python
    >>> import tensorflow as tf
    >>> print(tf.__version__)

To upgrade TensorFlow to the latest version:

        pip3 install --upgrade tensorflow

Installation and Configuration

A guide to installing TensorFLow on Windows can be found at: 人工智能课开发环境部署指南

Windows TensorFlow installation main steps:

  • Install Python3

Download and install the 64-bit version from www.python.org. Also, you may need to update your Eclipse PyDev setup to point your Python Interpreter to the new Python installation.

  • Install Python Package
        pip3 install matplotlib
        pip3 install scipy
        pip3 install sklearn
  • Install tensorflow
        pip3 install --upgrade tensorflow
       pip3 install --upgrade py4j

Run the Sample Case

  • Start InterPSS Power System Model Service

On Windows (or Linux) install and configure this Deep Machine Learning Repository. The ipss.dml project is depending on the ipss.lib project and ipss.lib.3rdPty project in the InterPSS Common Repository. These two projects should also be checked out to your local machine through the following step:

 1.From Eclipse, select File -­> import -> Git -> Projects from Git -> Clone URI.

 2.Add URI as follow: 1)https://github.com/InterPSS­Project/ipss­common.git;
   2) https://github.com/interpss/DeepMachineLearning.git

 3.Add the uer name and the password that you have applied on GitHub

 4.Select 'master' branch and then finish

Then start the AclfPyGateway InterPSS AclfNetwork model service. You should see the following output message if the service is started and running:

Starting Py4J org.interpss.service.AclfPyGateway ...
  • Run TensorFlow ML Case on Windows

Make sure that your PyDev configuration is set correctly, and updated to point to the lasted Python installation. In Eclipse, right-click a Python sample file, for example, predict_voltage.py, and select Run As -> Python Run to run the ML sample cases.

Linux

Installation and Configuration

  • Set Bash on Ubuntu on Windows

If you already have a Linux environment installed, skip this step.

If you are a Windows 10 user, the simplest way to get a Linux env running is to install Bach on Ubuntu on Windows. Please follow the Set Bash on Ubuntu on Windows page to do the installation and configuration. Also, you can use the following cmd to check your Ubuntu version. Make sure the version is 16.04 and above.

lsb_release -a
  • Python Installation

The default TensorFlow programming language is Python. You can follow the instructions on the Install TensorFlow page to install Python3.

  • TensorFlow Installation

Please follow the instructions on the Install TensorFlow page to install TensorFlow. Using the Native Pip method (without GPU) is recommended.

  • Py4J Installation

Py4J is used to bridge the communication between TensorFlow ML engine and InterPSS Power System Model service. Use the following command to install Py4J to your Python env on Linux:

sudo pip install py4j

Run the Sample Case

  • Start InterPSS Power System Model Service

(See Windows:Start InterPSS Power System Model Service)

  • Run TensorFlow ML Case on Unix

Copy the TensorFlow ML samples in the Sample Dir to your Linux env and the run the python program. The input case is the IEEE 14-Bus Loadflow case (ieee14.ieee), which is located in the testdata dir. You need to modify the following line in the python program to point to your file location.

filename = 'c:/temp/temp/ieee14.ieee'

You show see the following output when running loadflow.py

$ python3 predict_voltage.py
c:/temp/temp/ieee14.ieee  loaded,  no of Buses, Branches: 14, 20
Training step:  0
Training step:  1000
...
model output mismatch:  dPmax :  0.04276(pu) at Bus : Bus4,     dQmax :  0.01365(pu) at Bus : Bus9

On the InterPSS Model service side, you should see the following output:

Starting Py4J org.interpss.service.AclfPyGateway ...
c:/temp/temp/ieee14.ieee aclfNet case loaded
Total system load: 2.19991 + j0.63356, factor: 0.7042506337165833
Run Aclf  converged, dPmax :  0.0000(pu) at Bus : Bus9,     dQmax :  0.0000(pu) at Bus : Bus5
Total system load: 3.09176 + j0.86548, factor: 1.3804057836532593
Run Aclf  converged, dPmax :  0.00007(pu) at Bus : Bus9,     dQmax :  0.00004(pu) at Bus : Bus8
...