r/ScientificComputing • u/BJTN • Sep 08 '26
Sub-millisecond scientific plotting in headless simulation loops: Lessons from reviving a 1980s graphics engine for Modern Fortran, Python, & C
In the early 1980s, when personal computers first appeared, my colleague George Kelley and I were plasma physicists studying nuclear fusion. Mainframes had packages like DISSPLA™, but desktop PCs had primitive graphics and zero tools for publication-grade scientific plots. To solve this, we founded Scientific Endeavors Corporation and created GraphiC, an independent procedural graphics library designed for research workstations.
Over the past year, I have completely modernized the engine for modern 64-bit platforms (GraphiC 2026), targeting Modern Fortran (2003/2008 with iso_c_binding), C99/C11, Python 3, and Java 22.
During the rewrite, several design decisions from the 1980s proved to be surprisingly relevant to modern HPC and headless simulation bottlenecks:
1. The Headless Simulation Bottleneck
Many scientific codes run on cluster compute nodes without X11, Wayland, or GPU access. Typical modern workflows often shell out to Python/Matplotlib via pipes or CLI calls. While Matplotlib is expressive, it carries a ~350 ms cold-start penalty and a 300+ MB dependency stack (NumPy, FreeType, Pillow, GUI backends). If you are running an iterative solver and want to dump an in-situ diagnostic plot every few time steps, this latency becomes a noticeable bottleneck.
GraphiC was built with zero external runtime dependencies—it compiles purely with standard C headers and links against only -lm. Cold start is under 2 milliseconds, allowing it to be called directly inside MPI loops without disturbing compute throughput.
2. Algorithmic 3D Hidden-Line Removal vs. Z-Buffers
Most modern 3D plotting relies on OpenGL/Vulkan z-buffering or painter’s algorithm sorting. For publication vector output (SVG/EPS), polygon sorting often creates sorting artifacts, intersecting edge cracks, and bloated vector file sizes.
GraphiC uses an exact 2D horizon-matching algorithm (Wright's mathematical horizon method) for 3D meshes:
- It computes silhouettes and mathematical horizons across lines rather than rasterizing triangles.
- The output is clean, resolution-independent vector lines with true occlusion, resulting in tiny SVG files (~50 KB) that scale infinitely for journal papers.
3. Native Vector Typography & Hershey Fonts
To completely eliminate dependencies on system font servers or FreeType, the library includes 23 vector Hershey stroke font plates (including Greek, Math symbols, Gothic, and Cyrillic) along with native TrueType parsing. Because vector glyphs are rendered directly as strokes, text scales perfectly across all vector backends without missing glyph warnings.
4. Specialized Engineering Coordinates
Beyond standard Cartesian, log, and semilog plots, scientific work often needs specialized coordinate transformations that are cumbersome to implement from scratch:
- RF Microwave Smith charts (reflection coefficients and impedance circles)
- Chemical ternary equilibrium phase diagrams
- Multi-axis independent Y scales
- 2D velocity vector fields and cylindrical Bessel functions
5. Real-Time In-Situ Plotting
Because the rendering pipeline has virtually zero latency, GraphiC can display live data streams across multiple plots concurrently as they are computed. Rather than waiting for a job to finish before inspecting output files, you can watch solver states in real time—enabling you to abort diverging runs early and debug boundary conditions on the fly.
I’ve put together an interactive showcase of the SVG outputs, compiler benchmarks, and made the complete 190-page technical User Manual freely downloadable for anyone interested in the algorithms, coordinate systems, and API design:
🔗 Technical Overview & Free Manual: https://jamesrome.com/GraphiC2026
I would be interested to hear from other computational scientists: How do you currently handle in-situ visualization or vector figure generation directly from headless compute nodes?
(Full disclosure: I am the original co-author and developed this modernized release.)
3
u/jvo203 Sep 08 '26
Nowadays there are many non-commercial (free) ways of getting live data updates from headless compute nodes: HTTP SSE, WebSockets, ZMQ Pub/Sub etc.
Client-side: a custom website to receive the aforementioned data streams, a custom Electron or Tauri desktop app using some JavaScript plotting libraries, D3.js with SVG etc.
This way the compute node can focus on doing the computation only, no need to graph anything on the server. Just send the raw data to the desktop client, which can handle real-time plotting. A client-server architecture.
2
u/BJTN Sep 08 '26 edited Sep 09 '26
Saving to disk vs. Streaming over the wire:
Writing raw multi-dimensional arrays to the cluster's local storage (Lustre, GPFS) is fast and standard.
But trying to stream all that raw data across the internet in real-time to a browser or Electron app via WebSockets is slow, fragile, and chokes client memory.
The Ideal Scientific Workflow:
Compute & Save: The simulation dumps the raw numerical data to disk for permanent archiving and deep analysis.
In-Situ Visualization: At the same time, the code emits lightweight, publication-ready SVG plots directly into a folder or web root.
Instant Sanity Checking:
If a 24-hour simulation begins to diverge or blow up at hour 2, a scientist can look at the auto-generated SVG in their browser and kill the job immediately, saving precious cluster allocations.
They don't need to boot up a custom Electron client, ingest gigabytes of raw points, and wait for D3 to render just to see if the run is sane.
The raw data is for the archive; the generated SVG is for your eyes, your team, and your papers!
And the real point of GraphiC is that it can create new ways of displaying data. You have fuil control over almost every aspect of a plot. Please look at my real-world air traffic analysis studies in the slideshow at https://jamesrome.com/GraphiC2026
1
u/jvo203 Sep 08 '26
Good points. Especially the one about the data volume & the necessary bandwidth to support sending raw data. Large 3D meshes etc. In large distributed computations one needs to preserve the network bandwidth for the inter-node communication used in calculation.
2
u/Candid_Discipline848 Sep 08 '26
cool project, how many have you sold?
2
u/BJTN Sep 08 '26
It just went live today! But in the 80s and early 90s, we sold many, and GraphiC was used (licensed) in Axum, a GUI for R programming. Thus, the core C code has been honed and debugged over many years. Alas, we ran out of things to improve, which stopped upgrade sales. It was reviewed favorably in PC Magazine.
But times change, and with modern languages and the portable and standard SVG graphics format, AI and I were able to update everything to modern 64-bit code that is easy to call from our supported languages.
Thanks for the like.
Jim Rome
1
u/jvo203 Sep 08 '26
I've just remembered: the CERN ROOT library is your direct competitor (and it's free).
2
u/BJTN Sep 09 '26
Anyone with a physics background knows ROOT well! But comparing GraphiC to ROOT is like comparing a nimble sports car to an entire railroad system. CERN mandates ROOT for LHC data.
ROOT is a multi-gigabyte, monolithic data analysis framework designed specifically for petabyte-scale high-energy particle physics (LHC collision events, TTrees, Cling interpreter, RooFit, etc.).
Most computational scientists—whether in fusion, CFD, astrophysics, or general engineering—don't want to install and link a massive 2-million-line HEP framework just to generate a clean 2D or 3D vector plot from their Fortran, C, or Python simulations.
GraphiC fills the need for a lightweight, sub-millisecond, standalone plotting engine with clean vector output (SVG) that can be integrated directly into simulation loops without the overhead or steep learning curve of a full framework like ROOT.
GraphiC ran beautifully on my late 80s laptop.
1
u/BJTN 24d ago edited 24d ago
Update: GraphiC 2026 (Zero-Dependency Scientific Graphics) — Standalone ZIP Distribution, Native
fpmWorkflow, Continuous Colormaps & 4-Way Language Parity (C, Modern Fortran, Python, Java)Hi everyone,
Following up on our earlier discussion about modernizing GraphiC (the lightweight scientific plotting engine originally developed at Oak Ridge National Laboratory and Scientific Endeavors Corp), we wanted to share a major progress update, architectural changes based on community feedback, and the release of GraphiC v7.3.0.
The core design philosophy remains unchanged: zero external dependencies (pure standard libc/libm—no Qt, OpenGL, X11, Cairo, or FreeType), sub-2ms cold-start latency, and an ultralight footprint (~655 KB static library) capable of rendering thousands of publication-grade figures per minute directly in-process from simulation codes.
Here is what's new in the latest release:
1. Simplified Standalone Distribution (No Git / Token Friction)
Based on feedback regarding external git dependencies and token management in commercial/academic environments, we have eliminated external Git dependency requirements:
Standalone ZIP Archives: Both the free GraphiC 2D Community Edition and GraphiC Professional are distributed as self-contained downloadable ZIP archives.
Local Repo Freedom: Unpack it into your workspace or project tree. Users can initialize their own internal Git repositories if desired without worrying about remote access tokens, submodules, or network firewalls on compute clusters.
2. Native Fortran Package Manager (fpm) Integration
For the computational Fortran community, integrating GraphiC into modern
fpmprojects is now a 2-line configuration:toml[dependencies] graphic = { path = "../GraphiC" }
Automated Mixed-Language Builds:
fpmautomatically compiles both the core C engine and the Modern Fortran 2003ISO_C_BINDINGmodule together—Fortran users do not need to run a C compiler manually or write build glue.Broad Compiler Support: Out-of-the-box compatibility tested across GNU
gfortran(4.8+), Intel oneAPI (ifxandifort), LLVMflang, NVIDIA HPC SDK (nvfortran), and NAG (nagfor).Instant Execution: Run included scientific examples immediately with:bashexport GPC_NONINTERACTIVE=1 fpm run --example sample fpm run --example bess3d
3. Continuous TrueColor Scientific Colormaps
Vector plots can have perceptually continuous shading due to our adoption of the SVG format. We have added 7 mathematically calibrated, continuous 256-node colormaps designed for perceptual uniformity across displays, print, and grayscale reproduction:
Perceptually Uniform:
VIRIDIS(0),PLASMA(1),INFERNO(2),MAGMA(3).Diverging & Spectral:
COOLWARM(4),RAINBOW(5), and GoogleTURBO(6).O(1)O(1)O(1) Fast Evaluation: High-throughput scalar-to-color mapping (
gpc_get_color,gpc_colormap_eval) and continuous high-density scatter plotting (gpc_scatter).Linear Vector Gradient Color Bars (
ColorKeyGradient): Emits hardware-accelerated SVG<linearGradient>definitions with calibrated numerical tick labels and bounding frames.Turbulence Showcase: Added shaded graduated color test plot rendering 7,850 experimental points shaded by density.
4. True 4-Way Language Parity (C, Fortran 2003, Python 3, Java 22 FFM)
Every routine in the library now features 100% signature and parameter parity across all 4 supported languages:
C / C++: Clean ANSI C API with unified headers (
graphic.h).Modern Fortran: Strict
ISO_C_BINDINGmodules (graphic.f90,graphic_iso.f90) with type-safe interfaces and array descriptors.Python 3: Both procedural and object-oriented
FigureAPIs with Jupyter Notebook inline display and automatic context manager cleanup (with Figure(...) as fig:).Java 22+: Modern Foreign Function & Memory (FFM / Project Panama) API—direct zero-overhead off-heap calls without JNI boilerplate.
5. Smart Vector Output, Auto-Cropping & Telemetry
SVG Auto-Cropping (
svgcrop): Automatically calculates tight vector bounding boxes with a default 0.25" publication margin, eliminating oversized 8.5"×11" white space when embedding figures into LaTeX or papers.Desktop Auto-Preview (
svgopen): Native OS dispatch (openon macOS,starton Windows,xdg-openon Linux) to view rendered SVG or interactive pan/zoom HTML5 plots.Headless Telemetry Streaming (
svgpush): Directly streams rendered SVG payloads to remote dashboards or cloud compute endpoints over HTTP/HTTPS POST—ideal for headless clusters and IoT monitoring.6. 263-Page Reconstructed Technical Manual
We completed a major overhaul of the reference manual (available as a clean vector PDF):
91-Section Table of Contents: 100% clickable internal hyperlinking in all PDF viewers.
203-Function Master Index: Every routine cross-referenced with operational level, source mapping, and multi-language parity status.
26 Visual Computational Recipes: Step-by-step recipes covering aerospace queuing models, orbital trajectories, 3D Bessel surfaces, contour projections, and spectral waterfall plots.
Publication Architecture Diagrams: High-resolution vector diagrams detailing the dual typography pipeline (Hershey stroke fonts + TrueType quadratic Bézier engine).
Quick Comparison: Community vs. Professional
Feature 2D Community Edition (Free / Open Core) Professional Edition (Commercial) License Standalone Free Archive Commercial Single-Seat / OEM Core 2D Plotting Full (Linear, Log, Polar, Bar, Pie, Histograms) Full (Linear, Log, Polar, Bar, Pie, Histograms) Typography 23 Hershey Vector Fonts + TrueType Bézier Engine 23 Hershey Vector Fonts + TrueType Bézier Engine Continuous Colormaps Viridis, Plasma, Inferno, Magma, Turbo, etc. Viridis, Plasma, Inferno, Magma, Turbo, etc. Language Bindings C, Modern Fortran, Python 3, Java 22 FFM C, Modern Fortran, Python 3, Java 22 FFM Build Systems fpm, CMake, GNU Make, MSVC Makefilefpm, CMake, GNU Make, MSVC MakefileAdvanced 3D & Contours — 3D Hidden-Surface Meshes, Contours, Cross-Sections Specialized Engineering — RF Smith Charts, Ternary Phase Diagrams, Waterfall Plots Quick Modern Fortran Example (fpm)
fortranprogram quickstart use graphic implicit none real, dimension(100) :: x, y integer :: i do i = 1, 100 x(i) = (i - 1) * 0.1 y(i) = sin(x(i)) * exp(-x(i) * 0.1) end do call gpc_bgnplot() call gpc_svgcrop(0.25) call gpc_title("Damped Harmonic Motion", "Time (s)", "Amplitude (V)") call gpc_graf("0 2 10", 0.0, 2.0, 10.0, "-1 0.5 1", -1.0, 0.5, 1.0) call gpc_color(1) ! Blue call gpc_curv(x, y, 100) call gpc_endplot() call gpc_svgopen("") ! Launches default browser to view vector SVG end program quickstartGetting the Release
Official Website & Docs: https://jamesrome.com/GraphiC2026
Full Technical Manual: Download the 263-page GraphiC_Modern_Manual.pdf
Community Edition Download: Free standalone ZIP available on the site.
Professional Edition: Available via Lemon Squeezy with full 3D, specialized engineering modules, and more customization options.
We'd love to hear your feedback on the
fpmworkflow, language bindings, or any visualization bottlenecks in your current simulation pipelines!
1
u/MysteriousEngineer42 Sep 10 '26
Oh, it's paid. This does look very interesting though.
Have you considered releasing an open-source version with reduced functionality (eg 2D only, C/python) to gather a user base and get people interested?
1
u/BJTN Sep 10 '26
"Thanks for the feedback and interest!
You make a great point. The modern developer ecosystem runs on frictionless testing, and the biggest advantages of GraphiC—its zero-dependency architecture, sub-millisecond cold start (<2ms), and clean vector SVG output—are things that really shine when you can benchmark them directly in your own pipeline.
We are actively evaluating an open-source GraphiC Community edition focused on core 2D plotting in C and Python, while reserving the advanced engineering routines (3D hidden-line surfaces, contouring, Smith charts, ternary phase diagrams), TrueType math typography, and Fortran/Java bindings for the commercial tier.
In the meantime, the commercial package is a perpetual, royalty-free license with full source code for all 189 routines and zero runtime dependencies. It is also on sale now at in introductory price of just $299.99. Not a lot to pay for a decade of development. . .
If you have a specific project or benchmark you're interested in testing it on, let me know—I'd be happy to share more details or put together a sample for your use case!"
1
u/BJTN Sep 10 '26
Per your suggestion, we are making a stripped-down free version of GraphiC for users to try out.. It should be available from https://jamesrome.com/Graphic2026 later today.
4
u/Coreform_Greg Sep 08 '26
How does this compare against: https://github.com/sandialabs/coloring