diff --git a/README.md b/README.md index 5f168e4..aa4cb9d 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,41 @@ conda, run $ conda install six, numpy, wheel, protobuf ``` -### Build + +### Prepare envronment for Windows + +#### Install Protocol Compiler + +Note that this requires [Protocol Buffers 3](https://developers.google.com/protocol-buffers/?hl=en) compiler, so please install it as follows: +1. Download the windows version (protoc-xxxx-win32.zip) and extract (do not use spaces in the folder name e.g. C:/protoc-buffer) +2. Add the protocol buffer bin folder to the windows PATH (e.g. C:/protoc-buffer/bin). + +#### Install MS Visual Studio +bazel requires visual studio to be installed. The [Visual Studio Community](https://www.visualstudio.com/vs/community/) free version can be used. +After installation, make sure the installation is OK by running a Hello World C example. +You need to install Windows SDK for Windows 8 (available as an option within the installation of Visual Studio). + +#### Install Anaconda +Install [Anaconda](https://www.continuum.io/downloads). Use installer for python 2.7. +- Install for current user only to avoid permission issues. +- Select the installation root directory to be C:/Anaconda2 (to avoid spaces). +- Make it the default system python2.7 (option avilable through the installation). + +#### Install bazel for windows +This is the [bazel-windows](https://bazel.build/versions/master/docs/install-windows.html) installation instructions. +The simplest method is to use [chocolatey](https://chocolatey.org/) windows package manager. To install chocolatey follow this [link](https://chocolatey.org/install)). +- You may need to execute "Set-ExecutionPolicy Unrestricted" before installation. +- After chocolatey is installed , run "choco install bazel" command. It will install bazel dependencies (python27, JDK and MSYS) and then installs bazel. The python27 is not required since Anaconda will be used. + +After bazel is installed, apply the following system configurations: +1. Create a Windows Environment Variable BAZEL_SH=path/to/MSYS/bash(typically it will be C:\tools\msys64\usr\bin\bash.exe). +2. Add the MSYS bin (e.g. c:\tools\msys64\usr\bin) to the windows PATH at its start (before references to windows shell paths). +3. Create an environment variable JAVA_HOME=path/to/jdk (e.g. C:\Program Files\Java\jdk1.8.0_121). +4. bazel will automatically configure BAZEL_VS and BAZEL_PYTHON after it starts. +5. When bazel is running, it will search for python27.lib (actually the visual studio linker does). It is located under (C:/Anaconda2/libs). The Visual Studio must be able to see python27.lib in any of its search paths. This is can be done by copying python27.lib under one of the default search paths for visual studio built-in libs e.g. C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64). If there is a way to let VS see C:/Anaconda2/libs, it would be better. + + +### Build (Non-Windows) After that, to build the first part, simply: @@ -82,7 +116,6 @@ $ cd tensorboard $ sh installer.sh # In this process, it might need configuration or failed in bazel build, just retry the specific step. ``` - #### Configure the installation For example(just type ’N’ for all case as we don’t need them): @@ -96,6 +129,24 @@ Do you wish to build TensorFlow with GPU support? [y/N] N Do you wish to build TensorFlow with OpenCL support? [y/N] N ``` +### Build on Windows +For Windows run "bash installer_windows.sh" from cmd.exe + +```bash +C:\>cd tensorboard +C:\tensorboard>bash installer_windows.sh +# In this process, it might need configuration or failed in bazel build, just retry the specific step. +``` + +#### Configure the installation +After running the installer_windows.sh, the configuration options will appear. Type 'N' for all options since they are not needed. +Just use "C:/Anaconda2/python.exe" as the location of python. +```bash +$ ./configure +Please specify the location of python. [Default is /usr/bin/python]:C:/Anaconda2/python.exe +``` +After installation is OK (both tensorboard and tensorboard.runfiles are successfully generated under `tensorboard/tensorflow/bazel-bin/tensorflow/tensorboard`) go to tensorboard/python and type `python setup.py install` + ## Usage `dmlc/tensorboard` contains two parts in general, currently we have [Python interface](https://github.com/dmlc/tensorboard/tree/master/python) for writing/logging `scalar`, `histogram` and `image` data to `EventFile`, which the front-end load data from this event file for visualization. @@ -118,4 +169,4 @@ $ tensorboard --logdir=path/to/logs You might want to see the development note of this project at our DMLC blog: [Bring TensorBoard to MXNet](http://dmlc.ml/2017/01/07/bring-TensorBoard-to-MXNet.html) -Feel free to contribute your work and don't hesitate to discuss in issue with your ideas. \ No newline at end of file +Feel free to contribute your work and don't hesitate to discuss in issue with your ideas. diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/installer_windows.sh b/installer_windows.sh new file mode 100644 index 0000000..7ff17a1 --- /dev/null +++ b/installer_windows.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# make protobufs for logging part first +make all + +# get tensorflow +git clone https://github.com/tensorflow/tensorflow +cd tensorflow + +# run configuration. +bash configure --prefix=/mingw + +# build tensorboard +#bazel build tensorflow/tensorboard:tensorboard +bazel build -c opt --cpu=x64_windows_msvc --host_cpu=x64_windows_msvc --copt="/w" --verbose_failures tensorflow/tensorboard:tensorboard + +# prepare pip installation package +cp -r ../tools/* bazel-bin/tensorflow/tools/ + +# get .whl file in python/dist/ +bash bazel-bin/tensorflow/tools/pip_package/build_pip_package.sh ../python/dist/ + +# install tensorboard package from .whl file +cd .. +pip install python/dist/*.whl + +# clean up +echo 'Now you can remove tensorflow with rm -rf tensorflow' +#rm -rf tensorflow/ + diff --git a/python/tensorboard/summary.py b/python/tensorboard/summary.py index 4a09855..ac7afd0 100644 --- a/python/tensorboard/summary.py +++ b/python/tensorboard/summary.py @@ -183,7 +183,7 @@ def image(tag, tensor): def make_image(tensor, height, width, channel): """Convert an numpy representation image to Image protobuf""" image = Image.fromarray(tensor) - output = StringIO.StringIO() + output = StringIO() # This is working for python 2.7 image.save(output, format='PNG') image_string = output.getvalue() output.close() diff --git a/windows_bin/README.md b/windows_bin/README.md new file mode 100644 index 0000000..e4968cc --- /dev/null +++ b/windows_bin/README.md @@ -0,0 +1 @@ +Windows 10 tensorboard build output diff --git a/windows_bin/tensorboard b/windows_bin/tensorboard new file mode 100644 index 0000000..3d23fa1 Binary files /dev/null and b/windows_bin/tensorboard differ diff --git a/windows_bin/tensorboard.runfiles.7z b/windows_bin/tensorboard.runfiles.7z new file mode 100644 index 0000000..ce6b54b Binary files /dev/null and b/windows_bin/tensorboard.runfiles.7z differ