Wirewalk Instituteof AI
dev-304 Expert Waitlist

Fortran and HPC Codes: AI Surrogates in Scientific Simulation

For computational scientists and HPC developers who want to replace or accelerate expensive parts of Fortran and C++ simulation codes with machine-learned surrogates, without compromising correctness, scaling or reproducibility.

The curriculum is being prepared and reviewed. Enrollment is not open yet.

About this course

Many scientific codes spend most of their time in a few expensive components: a radiation or microphysics parameterization, a chemistry solver, a closure model, a constitutive law. A trained surrogate can make those components orders of magnitude cheaper, but only if it is coupled efficiently, stays stable over long integrations, respects physical constraints and can be validated to the standard a scientific result requires.

This course takes the HPC developer's view. You start by identifying surrogate candidates with profiling and by designing training data generation from the simulation itself. You then couple models to Fortran in-process: FTorch (LibTorch-backed, no Python at runtime), NVIDIA's TorchFort (inference and online training driven from Fortran or C/C++), Berkeley Lab's Fiats (native Fortran 2023 inference), and ONNX Runtime through iso_c_binding, and compare these with remote or file-based coupling. For C++ codes you use LibTorch and ONNX Runtime directly, including from Kokkos-based applications. You place inference on GPUs alongside MPI ranks, batch across grid points, manage device memory shared with the solver, and train online while the simulation runs. The final modules cover what makes results trustworthy: a priori and a posteriori testing, long-run stability, conservation and constraint enforcement, fallbacks to the physics routine, uncertainty, reproducibility and scaling studies. Library facts are as of October 2026; several of these libraries are research software with evolving APIs, and the course teaches how to isolate them behind a stable interface.

What you will be able to do

  • Identify surrogate candidates in a simulation code using profiling and physical criteria, and estimate the achievable end-to-end speedup
  • Design training data generation from a running simulation, including sampling of rare regimes and versioned, reproducible datasets
  • Couple a PyTorch model to a Fortran code with FTorch or TorchFort, and explain when Fiats or ONNX Runtime via iso_c_binding is the better fit
  • Integrate surrogate inference into a C++ or Kokkos-based code with LibTorch or ONNX Runtime, sharing device memory with the solver where possible
  • Place and batch inference on GPUs within an MPI-decomposed simulation and measure its effect on strong and weak scaling
  • Validate a hybrid model with a priori and a posteriori tests, long-run stability checks, conservation constraints and a physics fallback
  • Set up online training coupled to a running simulation and describe its numerical, reproducibility and resource risks

Syllabus

5 modules · 18 lessons · about 22 hours

Module 1: Surrogates in Scientific Computing

What to replace, why, and how to know whether it paid off.
3 lessons
  1. Where Surrogates Pay Off: Parameterizations, Closures, Chemistry and Constitutive Models
  2. Profiling a Simulation to Find Candidates and Bound the Speedup
  3. Generating Training Data from the Simulation Itself

Module 2: Designing and Training Surrogates for Physics

Model choices that respect the physics and the coupling constraints.
3 lessons
  1. Architectures for Surrogates: MLPs, CNNs, Neural Operators and Graph Networks
  2. Physical Constraints: Conservation, Positivity and Symmetry in the Loss and the Architecture
  3. Exporting Models for Compiled Codes: TorchScript, torch.export and ONNX

Module 3: Coupling to Fortran

Calling trained models from Fortran without a Python runtime.
4 lessons
  1. FTorch: Loading and Running PyTorch Models from Fortran
  2. TorchFort: Inference and Online Training Driven from Fortran
  3. Fiats and ONNX Runtime via iso_c_binding: Native and C-Interop Alternatives
  4. Hiding the Library Behind a Stable Fortran Interface

Module 4: Coupling to C++ and Running on GPUs at Scale

Inference inside MPI-parallel, GPU-accelerated codes.
4 lessons
  1. LibTorch and ONNX Runtime Inside C++ and Kokkos Codes
  2. GPU Placement, Batching Across Grid Points and Sharing Device Memory with the Solver
  3. MPI Decomposition, Rank-to-GPU Mapping and the Effect on Scaling
  4. In-Process vs Remote Inference Servers for Simulation Coupling

Module 5: Validation, Stability and Online Learning

Making hybrid results trustworthy and reproducible.
4 lessons
  1. A Priori vs A Posteriori Testing and Long-Run Stability
  2. Out-of-Distribution Detection, Fallback to Physics and Uncertainty Estimates
  3. Online Training Coupled to a Running Simulation
  4. Reproducibility, Provenance and Reporting Hybrid Results

Exam and certificate

The exam unlocks once you have completed every lesson. It draws 25 questions from a larger bank, spread across the modules, with the answer options shuffled for each attempt. You have 60 minutes and need 80% to pass. After a failed attempt you can try again after 24 hours, up to 3 attempts in total. Feedback is given per module, never as the answer key.

Passing earns a certificate of completion and assessment from the Wirewalk Institute of AI with a unique ID that anyone can check at institute.wirewalk.com/verify. It is not an accredited qualification or a vendor certification. How certification works.

The Wirewalk Institute of AI is independent. This course teaches publicly documented products and is not affiliated with or endorsed by Cambridge ICCS (FTorch), NVIDIA (TorchFort, PhysicsNeMo, CUDA), Berkeley Lab (Fiats), PyTorch (LibTorch), Microsoft (ONNX Runtime), Kokkos, or MPI and OpenMP. Product and company names are trademarks of their respective owners.

More in AI in Software Development

All 19 courses in this track
dev-001 Free intro Available

Your First AI API Call: A One-Hour Hands-On Start

A free, one-hour, hands-on start built on one realistic job: sorting a property manager's 1,150 monthly maintenance requests. You get an API key the safe way, make real calls with curl and an official Python SDK, run them over forty work orders, read stop reasons, usage and errors, estimate the monthly cost, and decide whether the script is ready. Exercises run on your own provider account for well under a dollar.

1 h · 7 lessons Free intro
dev-201 Intermediate Available

Python AI Integration: SDKs, Async, Pydantic, Packaging and Testing

A code-first course on integrating LLMs into Python the way production code needs it: uv projects and secrets, the OpenAI, Anthropic and Google GenAI SDKs side by side, async concurrency and streaming, Pydantic structured outputs and tools, retries, local models, embeddings and RAG, FastAPI and pandas integration, testing and evals with pytest, observability, cost tracking and deployment.

15 h · 19 lessons See price at checkout
dev-202 Intermediate Waitlist

Perl and AI: Modernizing Scripts and Text Pipelines with LLM APIs

Call OpenAI, Anthropic, Gemini and local Ollama models from Perl with real CPAN modules, add streaming, concurrency and validated JSON output to text pipelines, and use AI coding assistants to modernize legacy Perl behind characterization tests.

12 h · 18 lessons Join the waitlist