Serverless Fortran Code Execution w/ Time2Code and OpenFaaS

Jock Reed
3 min readOct 13, 2017

--

Since starting the Time2Code project I have promised to support additonal languages beyond the four I started with. Today I am releasing support for the Fortran language through serverless code execution.

This is typically not possible with traditional Cloud provider Serverless platforms to execute different languagues other than the few they support. However OpenFaaS makes this possible with a simple to use Serverless Function platform that runs containers on Docker Swarm and Kubernetes backends. If you can put it in a container, you can make a function out of it with OpenFaaS.

Let’s get you started quickly so you can start to pursue a new career with NASA. First we will deploy Time2Code. Give it a try on Play-With-Docker by following this link. Once Time2Code is deployed click on the link for the Web IDE.

Your Time2Code Play-With-Docker URL will look similar to this…

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/

I have prepared some pre-populated Fortran code examples to use from Fortran sample code snippets from around GitHub. When using the example links be mindful of the query parameters as those are used to pre-populate the web based IDE. Once loaded, click the run button to execute the code serverlessly.

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/?lang=fortran&code=https://github.com/cmacmackin/fortran-tutorial/blob/master/src/hello_world.f90

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/?lang=fortran&code=https://github.com/snood1205/fortran-tutorial/blob/master/gravitationalDisp.f90

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/?lang=fortran&code=https://github.com/snood1205/fortran-tutorial/blob/master/mainprog.f90

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/?lang=fortran&code=https://github.com/tiborh/fortran/blob/master/testingInt.f

http://pwd10-1-226-3-5555.host2.labs.play-with-docker.com/?lang=fortran&code=https://github.com/tiborh/fortran/blob/master/implicit.f

If you want to deploy Time2Code on your own laptop, and you have Docker CE installed on your computer, use the following command to get started with Time2Code.

$ docker swarm init --advertise-addr eth0 \
&& curl -O https://raw.githubusercontent.com/JockDaRock/Time2Code/master/time2deploy.sh \
&& sudo bash time2deploy.sh

Use http://127.0.0.1:5555 for your base URL if deploying from your laptop and Docker Swarm.

Congrats on executing Fortran code Serverlessly with Time2Code and OpenFaaS!

Visit here to here more about Time2Code: https://medium.com/@JockDaRock/time2code-functions-as-service-and-code-as-a-function-3d9125fc49fb, https://github.com/JockDaRock/Time2Code

Or go here to work with OpenFaaS on Kubernetes on Secure infrastructure: https://medium.com/@JockDaRock/serverless-at-the-helm-in-kubernetes-in-the-devnet-sandbox-2038031a3f4b

CALL TO ACTION

STAR Time2Code and OpenFaaS on github.

We are always looking for new contributors to both projects. Contribute to Time2Code by testing, making suggestions, improving code, making pull requests, raising issues, adding coding languages to go along with the web based IDE, writing blogs about your experiences, making coding tutorials in markdown on GitHub: https://github.com/JockDaRock/Time2Code

Contribute to OpenFaaS by testing, making suggestions, improving code, making pull requests, working on backend code, writing blogs about your projects you have created with OpenFaas: https://github.com/openfaas/faas, https://github.com/openfaas/faas-netes

--

--