Skip to content

Hackathon

Simon Clifford edited this page Sep 23, 2022 · 3 revisions

Ideal experience

  1. Fortran
  2. Some Python
  3. Little or no TensorFlow

Goals

We want to finish the process_model script so that integrating TensorFlow ML models into Fortran is simple(r). To achieve this I think we need to do the some or all of the following:

  1. Write a test for process_model. Interestingly this will require us to solve many of the problems, since the correct output will be the Fortran we need to generate!
  2. Have process_model generate this Fortran code.
  3. Make sure the Fortran code compiles and test it does what we want.
  4. There may be options we need to cover, these will need extra tests. E.g. loading two models, or passing a --tags option.
  5. Nicely document all of this. Perhaps a worked example.

Hackathon setup

process_model tool development

  1. Fork this repository into your Github account.
  2. Clone it locally, checking out the tensorflow branch. git clone -b tensorflow <your-repo-url>
  3. Create a python3 environment (virtualenv, conda) and activate it.
  4. Change to fortran-ml-bridge-hackathon/fortran-tf-lib/tools and run pip install -e process_model. This will install the tool as an editable package and bring in its dependencies.

The TensorFlow Fortran interface development

  1. Follow the instructions in the TF README to download and install the TensorFlow C library, and build the Fortran-TF library.
  2. Now when we run e.g. process_model -o test.F90 we can compile the outputted Fortran with something like the following:
ifort -c -I ../../src test.F90

(the argument to the -I flag is wherever the .mod file for the library has been generated).

  1. If we get to the point where we start building actual examples we'll need to link to the generated library, and the TF C library.
Clone this wiki locally