Introduction Design and Implementation Example Conclusion

A web-based service for distributing curve fitting

algorithms onto remote server clusters for

improved performance

Ra ́ul Negr ́on1

Paul Kienzle2

1University of Puerto Rico at R ́ıo Piedras 2NIST Center for Neutron Research

August 3, 2017
Introduction Design and Implementation Example Conclusion

Legal

Disclaimer

Certain commercial equipment, instruments, or materials are

identified in this presentation to foster understanding. Such

identification does not imply recommendation or endorsement by

the National Institute of Standards and Technology, nor does it

imply that the materials or equipment are necessarily the best

available for the purpose.
Introduction Design and Implementation Example Conclusion

Introduction

Project Idea

Bumps

Software package written in Python for curve fitting and

uncertainty analysis.

Build a web service back-end for running remote jobs

Extend bumps functionality to integrate the web service
Introduction Design and Implementation Example Conclusion

Introduction

Project Goals

Allow for improved performance
Introduction Design and Implementation Example Conclusion

Introduction

Project Goals

Allow for improved performance

Minimal setup for both server administrators and clients
Introduction Design and Implementation Example Conclusion

Introduction

Project Goals

Allow for improved performance

Minimal setup for both server administrators and clients

Lower barrier to entry for interested users
Introduction Design and Implementation Example Conclusion

Introduction

Terms

Computer cluster A collection of interconnected computers

(nodes) that perform computationally-intensive work
Introduction Design and Implementation Example Conclusion

Introduction

Terms

Computer cluster A collection of interconnected computers

(nodes) that perform computationally-intensive work

HPC ”High performance computing”; Used to describe servers

built for performance (”Supercomputers”)
Introduction Design and Implementation Example Conclusion

Introduction

Terms

Computer cluster A collection of interconnected computers

(nodes) that perform computationally-intensive work

HPC ”High performance computing”; Used to describe servers

built for performance (”Supercomputers”)

Workload Manager Resource access control for a cluster. Common

tasks include job scheduling and load management.
Introduction Design and Implementation Example Conclusion

Bumps

Bumps basics

Optimizers include...

Levenberg–Marquardt

Nelder-Mead

DREAM

Some other features

Markov Chain Monte Carlo sampler

Optional parallelism using MPI

Built-in optional graphical interface
Introduction Design and Implementation Example Conclusion

Bumps

Bumps example (Linear Equation)

curve.py

from bumps.names import *

x = [1, 2, 3, 4, 5, 6]

y = [2.1, 4.0, 6.3, 8.03, 9.6, 11.9]

dy = [0.05, 0.05, 0.2, 0.05, 0.2, 0.2]

def line(x, m, b=0):

return m * x + b

M = Curve(line, x, y, dy, m=2, b=2)

M.m.range(0, 4)

M.b.range(-5, 5)

problem = FitProblem(M)
Introduction Design and Implementation Example Conclusion

Bumps

Running the curve fit

$ bumps curve.py --fit=newton --steps=100 --store=temp

produces...
Introduction Design and Implementation Example Conclusion

Bumps

Bumps performance and a motivation for the web service

Small problem space; efficient algorithms don’t affect much

Model functions can be somewhat expensive

Running multiple models in parallel is an easy way to improve

performance
Introduction Design and Implementation Example Conclusion

Workload Managers

Slurm

Slurm basics

Free and open-source software

Job scheduler

Progress monitor

Load manager

Available on many modern server clusters (Ex. UMD)
Introduction Design and Implementation Example Conclusion

Workload Managers

Slurm example

job.slurm

#!/bin/bash

#SBATCH --mail-user=raul@upr.edu

#SBATCH --nodes=2

#SBATCH --ntasks=1

#SBATCH --time=00:10:00

#SBATCH --mem=500M

#SBATCH --output=python_job.out

python problem.py
Introduction Design and Implementation Example Conclusion

Workload Managers

Service Diagram
Introduction Design and Implementation Example Conclusion

Workload Managers

Primary Services

A Flask server is used to implement the web service API

Redis is used to store web service metadata such as:

Job-User association

Job submission date

Docker provides service containers for easy setup

Docker and the Docker logo are trademarks of Docker, Inc.

Redis and the Redis logo are trademarks of Salvatore Sanfilippo
Introduction Design and Implementation Example Conclusion

Workload Managers

Docker based installation of the web service

$ docker pull redis:latest

$ docker build . -t bumps

$ docker run --name bumps_redis -d redis

$ docker run --link bumps_redis -p 5000:5000 bumps
Introduction Design and Implementation Example Conclusion

Web page example

Video Demo

https://youtu.be/rcegYcqtREo

https://vimeo.com/226938525
Introduction Design and Implementation Example Conclusion

Web page example

Landing page
Introduction Design and Implementation Example Conclusion

Web page example

User dashboard before job submission
Introduction Design and Implementation Example Conclusion

Web page example

Setting up a bumps/slurm job
Introduction Design and Implementation Example Conclusion

Web page example

User dashboard after job submission
Introduction Design and Implementation Example Conclusion

Web page example

Results after job completion
Introduction Design and Implementation Example Conclusion

Web page example

Results after job completion (cont.)
Introduction Design and Implementation Example Conclusion

Web page example

Resulting Matplotlib/D3.js HTML model graph
Introduction Design and Implementation Example Conclusion

Web page example

Resulting Slurm file

#!/bin/bash

#SBATCH job-name=My_Very_Important_Job

#SBATCH --mail-user=raul@me.com

#SBATCH --time=00:00:40

#SBATCH --ntasks=64

#SBATCH --mem-per-cpu=16G

bumps [...]/[user_folder]/poisson.py \

--batch --stepmon --burn=600 --fit=dream \

--store=[...]/[user_folder]/results
Introduction Design and Implementation Example Conclusion

Conclusion

Results

Client/Server infrastructure using Flask

Docker images for simple setup

Slurm file parsing from web forms and command line

Simple web page interface to the service

MPLD3-based interactive, in-browser graphs
Introduction Design and Implementation Example Conclusion

Conclusion

Get the code

Project repository: https://github.com/rnegron/bumps

Public domain code!
Introduction Design and Implementation Example Conclusion

Conclusion

Acknowledgments

A big thank you to:

Paul Kienzle, Julie Borchers, Joe Dura,

Brandi Toliver
Introduction Design and Implementation Example Conclusion

Conclusion

Thank you!

Questions?