Efficient Geophysical Research in Julia Aaron Stanton, Wenlei Gao, and Mauricio D. Sacchi 1.

Slides:



Advertisements
Similar presentations
Chapter 11 Introduction to Programming in C
Advertisements

Programming Paradigms and languages
Recursion vs. Iteration The original Lisp language was truly a functional language: –Everything was expressed as functions –No local variables –No iteration.
Reflection Seismic Processing
File Systems.
MATLAB Presented By: Nathalie Tacconi Presented By: Nathalie Tacconi Originally Prepared By: Sheridan Saint-Michel Originally Prepared By: Sheridan Saint-Michel.
Data Analytics and Dynamic Languages Lee E. Edlefsen, Ph.D. VP of Engineering 1.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
Guide To UNIX Using Linux Third Edition
JPEG Compression in Matlab
Discussion Section: HW1 and Programming Tips GS540.
 Knowledge and use of tools and resources in a system: standard libraries, system calls, debuggers, the shell environment, system programs and scripting.
Universal Linear Algebra API based on M4 Michael Fiero Isaac Asiamah.
Dr. Chris Musselle – Consultant R Meets Julia Dr Chris Musselle.
Avro Apache Course: Distributed class Student ID: AM Name: Azzaya Galbazar
CIS Computer Programming Logic
Implementation Yaodong Bi. Introduction to Implementation Purposes of Implementation – Plan the system integrations required in each iteration – Distribute.
Implement High-level Program Language on JVM CSCE 531 ZHONGHAO LIU ZHONGHAO LIU XIAO LIN.
 200 Total Points ◦ 74 Points Writing Programs ◦ 60 Points Tracing Algorithms and determining results ◦ 36 Points Short Answer ◦ 30 Points Multiple Choice.
Compiled Matlab on Condor: a recipe 30 th October 2007 Clare Giacomantonio.
1 Computer Programming (ECGD2102 ) Using MATLAB Instructor: Eng. Eman Al.Swaity Lecture (1): Introduction.
FLUKA GUI Status FLUKA Meeting CERN, 10/7/2006.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
 140 Total Points ◦ 100 Points Writing Programs ◦ 24 Points Tracing Algorithms and determining results ◦ 16 Points Short Answer  Similar to quizzes.
GEOL882.3 Seismic Processing Systems Objective Processing Systems SEGY and similar file formats General structure of several systems.
 200 Total Points ◦ 75 Points Writing Programs ◦ 60 Points Tracing Algorithms and determining results ◦ 35 Points Short Answer ◦ 30 Points Multiple Choice.
Beach Energy Ltd Lake Tanganyika 2D Transition Zone Seismic Survey
Separate Compilation Bryce Boe 2013/10/09 CS24, Fall 2013.
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
Efficient Geophysical Research in Julia
Programming Massively Parallel Graphics Multiprocessors using CUDA Final Project Amirhassan Asgari Kamiabad
A Parallel Hierarchical Solver for the Poisson Equation Seung Lee Deparment of Mechanical Engineering
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Bradley, Barbare, Wagner
Lecture 3 Translation.
Big Data Analytics and HPC Platforms
ADVANCED MARINE TUTORIAL
Andy Wang Object Oriented Programming in C++ COP 3330
Time and Depth Imaging Algorithms in a Hardware Accelerator Paradigm
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Pipecut – an Interactive Pipeline editor
ITCS-3190.
Software for scientific calculations
MatLab Programming By Kishan Kathiriya.
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
New trends in parallel computing
C++ for Engineers and Scientists Second Edition
Operation System Program 4
CS 2308 Final Exam Review.
The Future of Fortran is Bright …
Programming in Perl Introduction
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
Chapter 11 Introduction to Programming in C
GPU Implementations for Finite Element Methods
ns-3 Waf build system ns-3 Annual Meeting June 2017
Andy Wang Object Oriented Programming in C++ COP 3330
Chapter 11 Introduction to Programming in C
Memory Management Overview
Chapter 2: Operating-System Structures
Chapter 11 Introduction to Programming in C
Understand the interaction between computer hardware and software
Appendix F C Programming Environment on UNIX Systems
EE 312 Final Exam Review.
Chapter 11 Programming in C
Implementation of a De-blocking Filter and Optimization in PLX
CS 2308 Final Exam Review.
SPL – PS1 Introduction to C++.
Chapter 11 Introduction to Programming in C
Introduction to Classes and Objects
Presentation transcript:

Efficient Geophysical Research in Julia Aaron Stanton, Wenlei Gao, and Mauricio D. Sacchi 1

Outline Motivation Julia Seismic.jl Examples 2

Motivation Matlab is a great prototyping language – easy to understand, compact code – many built in functions for linear algebra and plotting But… – inefficient for large problems – not open source Compiled languages are great for implementation – efficient for large problems – support all forms of parallelism But… – difficult to follow – inefficient to code and debug 3

Motivation Julia presents a new opportunity with Matlab-like syntax, C-like performance, and is free and open source This allows SAIG to make efficient, easy to read prototypes for our sponsors that can be readily implemented in their systems 4

Julia Released in 2012 Completely open source with MIT license Just-In-Time compiler – compiled after execution begins – has access to more information than static compilers Sophisticated type system Multiple dispatch Rich library of linear algebra and plotting functions Distributed and shared memory parallelism Pass-by-reference (pointers) Directly call C-libraries with no overhead 5

Julia’s Motivations We want a language that’s open source, with a liberal license. We want the speed of C with the dynamism of Ruby. We want a language that’s homoiconic, with true macros like Lisp, but with obvious, familiar mathematical notation like Matlab. We want something as usable for general programming as Python, as easy for statistics as R, as natural for string processing as Perl, as powerful for linear algebra as Matlab, as good at gluing programs together as the shell. Something that is dirt simple to learn, yet keeps the most serious hackers happy. We want it interactive and we want it compiled. (Did we mention it should be as fast as C?) 6

Matlab-like syntax Matlab y = zeros(nx1,nx2,nx3,nx4); for iw = 1 : nw y(:) = d(iw,:) x = y for iter = 1 : Niter Y = fftn(y); Y = Threshold(Y,p(iter)); y = ifftn(Y); y = a*x + (1 - a*T).*y end d(iw,:) = y(:) end Julia y = zeros(nx1,nx2,nx3,nx4); for iw = 1 : nw y[:] = d[iw,:] x = copy(y) for iter = 1 : Niter Y = fft(y); Y = Threshold(Y,p[iter]); y = ifft(Y); y = a*x + (1 - a*T).*y end d[iw,:] = y[:] end 7

Example: For-Loops Multi-level for-loop: a = 0.0 for j1=1:300; for j2 =1:300; for j3=1:300; for j4=300; a += 1.0; end Matlab: seconds Julia: seconds 8

Example: For-Loops Multi-level for-loop: a = 0.0 for j1=1:300; for j2 =1:300; for j3=1:300; for j4=300; a += 1.0; end Matlab: seconds Julia: seconds include(“foo.jl”) seconds (27.01 M allocations: MB)

Example: For-Loops Multi-level for-loop: function foo() a = 0.0 for j1=1:300; for j2 =1:300; for j3=1:300; for j4=300; a += 1.0; end Matlab: seconds Julia: seconds foo() seconds (6.97 k allocations: KB)

Example: Calling a C library t1 = ccall( (:time, "libc"), Int32, ()) a = 0 for i = 1 : 1e4 for j = 1 : 1e4 a += 1 end t2 = ccall( (:time, "libc"), Int32, ()) println("This program took ",t2 - t1," seconds.") OUTPUT: This program took 6 seconds. 11

Example: Parallelism a (+) for i=1:1e6 randn() end addprocs(20); foo(); julia -p 20 foo.jl julia --machinefile nodes.txt foo.jl omplace -nt 12 julia --machinefile nodes.txt foo.jl 12

Seismic.jl 13

Installation 14 Pkg.add(“Seismic”)

15

16

Basic usage 17 using PyPlot,Seismic; download(" 79/616_79/PROCESSED/616_79_PR.SGY","616_79_PR.SGY"); SegyToSeis("616_79_PR.SGY","616_79_PR.seis"); d,h,e = SeisRead("616_79_PR.seis"); SeisPlot(d[1:500,:],e,cmap="PuOr",wbox=9);

Basic usage 18

Basic usage 19 using PyPlot,Seismic; download(" ers.sgy") SegyToSeis("npr3_gathers.sgy","npr3_gathers.seis"); SeisGeometry("npr3_gathers.seis",ang=90, omx=788937,omy=938845, dmx=110,dmy=110,oh=0, oaz=0,dh=420,daz=45) h = SeisReadHeaders("npr3_gathers.seis") im1 = SeisPlotCoordinates(h,style="sxsygxgy") im2 = SeisPlotCoordinates(h,style="fold",cmap="jet",vmin=0,vmax=50, aspect="auto",xlabel="imx",ylabel="imy")

Basic usage 20

Basic usage 21

Data format The.seis file format is a clone of madagascar and SEPLIB’s format (.rsf) a.seis file is just a text file with information and file paths to the data and the headers Environmental variable DATAPATH can be set to store your data and headers in a particular directory, but the default is the current directory N traces x N samples of Binary IEEE floats 22

Header format 23 For each trace the header is stored as type Header N traces x 31 Binary IEEE floats/integers To see all fields type “names(Header)”

Package Contents Utilities Processing Imaging Solvers 24

Utilities Conversion to/from SEGY, SU, and RSF formats Reading and writing of internal format Windowing Geometry Header statistics Sorting Binning Patching/UnPatching Processing on groups of traces 25

Processing Semblance NMO Mute Stack Bandpass and FK fan filtering Radon transform 5D interpolation Structural Smoothing FX deconvolution Plane wave destruction for dip estimation … 26

Imaging Pre-stack time migration Wave equation migration, modeling, and least squares migration 27

Solvers Dot product test Memory or disk based preconditioned conjugate gradients Iteratively Reweighted Least Squares (IRLS) Fast Iterative Soft Thresholding Algorithm (FISTA) 28

Examples 29

Calling POCS Interpolation using Seismic dpocs = Seismic.pocs(ddec,Niter=100,fmax=60,dt=0.004); 30

Interpolation input 31

Interpolation output 32

Calling Plane Wave Destruction using Seismic download(" SegyToSeis("kevin_0off_velocity.su","kevins_model",{"format"=>"su"}); d,h,e = SeisRead("kevins_model"); coh,pp,res = SeisPWD(d,w1=30,w2=20,dx=8,dz=4); 33

Estimated reflector normals 34

Conclusions Julia can be used for fast prototyping as well as large scale production Julia programs are easy to follow for implementation in other languages We developed a package in Julia that is part of the ecosystem of Julia packages: Pkg.add(“Seismic”) – Utilities – Processing – Imaging – Inversion Additional closed-source packages are available to SAIG sponsors 35

References

Acknowledgements Thanks to the creators of Julia and to Sam Kaplan for introducing us to Julia Thanks to the sponsors of the Signal Analysis and Imaging Group for their generous support 37

38