Commit 707d0bfd authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: guard JCuda GPUTileProcessor init behind the JNA backend flag

The RT/CUAS path runs on the JNA native backend (libtileproc.so, offline
nvcc 12.8); the legacy JCuda GPUTileProcessor is not needed there and its
NVRTC+cuLinkAddData dies on Blackwell/sm_120 (jcuda 12.6 emits compute_120
PTX the driver JIT rejects -> CUDA_ERROR_INVALID_PTX; no jcuda 12.8 exists).
- New maybeBuildGpuTileProcessor(): returns null (one-shot console note) when
  -Dtp.backend=jna, else builds GPUTileProcessor exactly as before. GpuQuad.
  create()/createRectilinear() already ignore a null gpuTileProcessor in JNA
  mode, and every GPU_TILE_PROCESSOR use is null-guarded or JCuda-only
  (ComboMatch orthomosaic already refuses JNA mode explicitly).
- All 19  sites in
  Eyesis_Correction now call the guard.
GUARD, not removal: jcuda mode (default, and the FOPEN/oracle path on its own
branch) is byte-for-byte unchanged, so JCuda stays available as the FOPEN
JCuda->JNA migration oracle. RT runs (-Dtp.backend=jna) no longer touch JCuda
-> no INVALID_PTX regardless of menu path. mvn package + test PASS.
Co-authored-by: 's avatarClaude Opus 4.8 <claude-opus-4-8@anthropic.com>
Co-authored-by: 's avatarClaude Fable 5 <claude-fable-5@anthropic.com>
parent b48ee82a
...@@ -224,6 +224,30 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -224,6 +224,30 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
public static QuadCLT QUAD_CLT_AUX = null; public static QuadCLT QUAD_CLT_AUX = null;
public static TwoQuadCLT TWO_QUAD_CLT = null; public static TwoQuadCLT TWO_QUAD_CLT = null;
public static GPUTileProcessor GPU_TILE_PROCESSOR = null; public static GPUTileProcessor GPU_TILE_PROCESSOR = null;
private static boolean jcuda_skip_reported = false; // one-shot note when JNA mode skips JCuda init // By Claude on 07/18/2026
/**
* Build the legacy JCuda GPUTileProcessor, OR skip it (return null) when the
* JNA backend is selected (-Dtp.backend=jna). The RT/CUAS path runs on the
* JNA native backend (libtileproc.so, offline nvcc 12.8) which never needs
* GPUTileProcessor; GpuQuad.create() ignores a null gpuTileProcessor in JNA
* mode. This guard keeps JCuda from initializing on Blackwell/sm_120, where
* jcuda 12.6's NVRTC emits compute_120 PTX the driver JIT rejects
* (CUDA_ERROR_INVALID_PTX) - there is no jcuda 12.8. It is a GUARD, not a
* removal: JCUDA mode (the default, and the FOPEN/oracle path) still builds
* GPUTileProcessor exactly as before. By Claude on 07/18/2026.
*/
private static GPUTileProcessor maybeBuildGpuTileProcessor() throws IOException {
if (GpuQuad.useJnaBackend()) {
if (!jcuda_skip_reported) {
jcuda_skip_reported = true;
System.out.println("Eyesis_Correction: JNA backend (-Dtp.backend=jna) active - "+
"skipping legacy JCuda GPUTileProcessor init (not needed by the native path; "+
"avoids CUDA_ERROR_INVALID_PTX on sm_120). JCuda path unchanged in jcuda mode.");
}
return null;
}
return new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
}
// Add macro for GPU_QUAD? // Add macro for GPU_QUAD?
public static GpuQuad GPU_QUAD = null; public static GpuQuad GPU_QUAD = null;
public static GpuQuad GPU_QUAD_AUX = null; public static GpuQuad GPU_QUAD_AUX = null;
...@@ -4789,7 +4813,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -4789,7 +4813,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -4936,7 +4960,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -4936,7 +4960,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -6054,7 +6078,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -6054,7 +6078,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL; DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -6185,7 +6209,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -6185,7 +6209,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated,
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -6275,7 +6299,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -6275,7 +6299,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated,
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -6444,7 +6468,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -6444,7 +6468,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7047,7 +7071,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7047,7 +7071,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
} }
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7504,7 +7528,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7504,7 +7528,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7590,7 +7614,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7590,7 +7614,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7687,7 +7711,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7687,7 +7711,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7780,7 +7804,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7780,7 +7804,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7874,7 +7898,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7874,7 +7898,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -7960,7 +7984,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -7960,7 +7984,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8047,7 +8071,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8047,7 +8071,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8135,7 +8159,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8135,7 +8159,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8220,7 +8244,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8220,7 +8244,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8306,7 +8330,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8306,7 +8330,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8409,7 +8433,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8409,7 +8433,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
...@@ -8502,7 +8526,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -8502,7 +8526,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
if (GPU_TILE_PROCESSOR == null) { if (GPU_TILE_PROCESSOR == null) {
try { try {
GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu); GPU_TILE_PROCESSOR = maybeBuildGpuTileProcessor(); // JNA mode -> null (skips JCuda) // By Claude on 07/18/2026
} catch (Exception e) { } catch (Exception e) {
System.out.println("Failed to initialize GPU class"); System.out.println("Failed to initialize GPU class");
// TODO Auto-generated catch block // TODO Auto-generated catch block
......
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