Commit 41db46f1 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: Step 3 — backend selector (GpuQuad.create factory + -Dtp.backend=jna), 32 sites routed

GpuQuad.create(gpuTileProcessor, quadCLT, debug) returns the JCuda GpuQuad by default, or the native
GpuQuadJna when -Dtp.backend=jna (srcdir/devrt overridable via -Dtp.jna.srcdir / -Dtp.jna.devrt).
Routed all 32 main+aux `new GpuQuad(...)` 3-arg sites in Eyesis_Correction.java through the factory.
JCUDA remains the default (behavior identical when the property is unset). mvn -DskipTests compile clean.

Migration now fully implemented + compiling end-to-end (Step 1 native TpProc API, Step 2 GpuQuadJna
full CUAS surface, Step 3 selector). Ready for the JCUDA-vs-JNA comparison + incremental troubleshooting.
Co-Authored-By: 's avatarClaude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 131b371e
......@@ -490,6 +490,25 @@ public class GpuQuad{ // quad camera description
texture_stride_rgba = (int)(device_stride[0] / Sizeof.FLOAT);
}
// Backend selector (architecture B). Default JCUDA; set -Dtp.backend=jna to use the native
// (libtileproc.so via JNA) backend GpuQuadJna instead. JNA mode never initializes JCuda.
// Validate by running the same workflow both ways and diffing saved outputs.
public static boolean useJnaBackend() {
return "jna".equalsIgnoreCase(System.getProperty("tp.backend", "jcuda"));
}
public static GpuQuad create(
GPUTileProcessor gpuTileProcessor,
final QuadCLT quadCLT,
int debug_level) {
if (useJnaBackend()) {
String src = System.getProperty("tp.jna.srcdir", "/home/elphel/git/tile_processor_gpu/src");
String devrt = System.getProperty("tp.jna.devrt", "/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a");
System.out.println("GpuQuad.create(): NATIVE (JNA) backend for "+quadCLT+" (src="+src+")");
return new com.elphel.imagej.gpu.jna.GpuQuadJna(quadCLT, src, devrt, debug_level);
}
return new GpuQuad(gpuTileProcessor, quadCLT, debug_level);
}
// No-allocation constructor for the native (JNA) backend subclass GpuQuadJna.
// Sets the final config fields from quadCLT but allocates NO JCuda GPU memory and creates NO
// JCuda context (gpuTileProcessor = null). The subclass owns its native (TpProc) GPU memory and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment