Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

  • Add noInterop setting to GlobalSettings (defaults to true)
  • Parse --interop command line argument in GUI Main.cpp (enables interop mode)
  • Modify CudaGeometryBuffers to support non-interop mode with CPU/GPU memory transfers
  • Modify GeometryKernelsService::extractObjectData to handle both interop and non-interop modes (no separate method)
  • Simplify SimulationCudaFacade::copyBuffersFromCudaToOpenGL - delegate buffer details to CudaGeometryBuffers
  • Update _GeometryBuffers class to support uploading from host memory
  • Add GeometryTests for getNumRenderObjects and tryCopyBuffersFromCudaToOpenGL (no-interop mode only)
  • Build and test the changes

Usage

  • Default: ./alien (runs in no-interop mode, uses CPU-GPU memory transfers)
  • Enable interop: ./alien --interop (uses CUDA-OpenGL interop for rendering)
Original prompt

Implement the following extension: if alien is executed with --no-interop parameter, no cuda-opengl-interop api should be called. instead the memory should be copied between cou and gpu.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

When the --no-interop flag is provided to the ALIEN GUI:
- CUDA-OpenGL interop API calls are bypassed
- Rendering data is copied from GPU to CPU using cudaMemcpy
- CPU-side data is uploaded to OpenGL buffers via glBufferSubData

This is useful for systems where CUDA-OpenGL interop doesn't work.

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copilot AI changed the title [WIP] Add handling for --no-interop parameter in alien Add --no-interop parameter to disable CUDA-OpenGL interoperability Jan 3, 2026
Copilot AI requested a review from chrxh January 3, 2026 12:11
syncAndCheck();

// Copy from device to host and upload to OpenGL
if (numRenderObjects.cells > 0) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot hide all these details here about the concrete buffers away from SimulationCudaFacade. Maybe CudaGeometryBuffers is a better place for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored in dab791d. Moved all buffer copying logic to CudaGeometryBuffers::copyToOpenGL() method. SimulationCudaFacade::copyBuffersFromCudaToOpenGL() now just calls _cudaGeometryBuffers->copyToOpenGL(geometryBuffers, numRenderObjects).

void restorePositions(SettingsForSimulation const& settings, SimulationData data);
NumRenderObjects getNumRenderObjects(SettingsForSimulation const& settings, SimulationData data, RealRect const& visibleWorldRect);
void extractObjectData(SettingsForSimulation const& settings, SimulationData data, CudaGeometryBuffers& renderingData, RealRect const& visibleWorldRect);
void extractObjectDataNoInterop(SettingsForSimulation const& settings, SimulationData data, CudaGeometryBuffers& renderingData, RealRect const& visibleWorldRect);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot do not add an extra method for the non interop case. extractObjectData should handle this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dab791d. Removed extractObjectDataNoInterop - extractObjectData now handles both interop and non-interop modes internally by checking GlobalSettings::get().isNoInterop().

… merge extractObjectData methods

- Removed extractObjectDataNoInterop from GeometryKernelsService
- extractObjectData now handles both interop and non-interop modes internally
- Added copyToOpenGL method to CudaGeometryBuffers for CPU-GPU-OpenGL transfer
- Simplified SimulationCudaFacade::copyBuffersFromCudaToOpenGL to delegate to CudaGeometryBuffers

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copilot AI requested a review from chrxh January 3, 2026 12:53
@chrxh
Copy link
Owner

chrxh commented Jan 3, 2026

@copilot write parameterized tests for GeometryKernelsService with and without interop. For this, add the new test class GeometryTests. Make minimal usages of comments (only when necessary for the understanding).

- Added GeometryTests.cpp with parameterized tests that run with both interop modes
- Added testOnly_getNumRenderObjects method to SimulationFacade interface
- Tests verify render object counting works consistently in both modes

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 3, 2026

@copilot write parameterized tests for GeometryKernelsService with and without interop. For this, add the new test class GeometryTests. Make minimal usages of comments (only when necessary for the und...

Added in c38c52f. Created GeometryTests class with parameterized tests for both interop modes (false and true). The tests verify getNumRenderObjects functionality with cells, particles, connections, and creatures. Added testOnly_getNumRenderObjects method to the facade interface for test access.


INSTANTIATE_TEST_SUITE_P(InteropModes, GeometryTests, ::testing::Values(false, true));

TEST_P(GeometryTests, getNumRenderObjects_emptySim)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot getNumRenderObjects does not depend on the flag non-interop. Here one does not need parameterized tests.
Add also tests for _SimulationFacade::tryCopyBuffersFromCudaToOpenGL. Here the parameterization is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 87001de. Removed parameterization from getNumRenderObjects tests (now TEST_F). Added GeometryTests_CopyBuffers class with parameterized tests for tryCopyBuffersFromCudaToOpenGL. Interop mode tests (/0) skip when CUDA-OpenGL interop is unavailable; no-interop mode tests (/1) run and pass.

…ameterized copyBuffers

- Removed parameterization from getNumRenderObjects tests (not interop-dependent)
- Added parameterized tests for tryCopyBuffersFromCudaToOpenGL with interop modes
- Tests with interop mode skip gracefully when CUDA-OpenGL interop is unavailable
- Tests with no-interop mode (GetParam()=true) run and pass

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copilot AI requested a review from chrxh January 4, 2026 21:28
@chrxh
Copy link
Owner

chrxh commented Jan 4, 2026

@copilot make all GeometryTests for no-interop mode (i.e. remove parameterization) since openGL context is not available in test environment.

- Merged GeometryTests and GeometryTests_CopyBuffers into single GeometryTests class
- All tests now run in no-interop mode (GlobalSettings::get().setNoInterop(true))
- Removed parameterization since OpenGL context is not available in test environment

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot make all GeometryTests for no-interop mode (i.e. remove parameterization) since openGL context is not available in test environment.

Fixed in b183260. Simplified GeometryTests to use no-interop mode only - removed parameterization and merged both test classes. All 15 tests now run in no-interop mode with GlobalSettings::get().setNoInterop(true).

@chrxh
Copy link
Owner

chrxh commented Jan 5, 2026

@copilot alien should be started with non interop mode by default. Change the CLI parameter --no-interop to --interop such that the user must explicitly set interop mode.

- Default to no-interop mode (noInterop = true)
- Changed CLI parameter from --no-interop to --interop
- User must now explicitly pass --interop to enable CUDA-OpenGL interop

Co-authored-by: chrxh <73127001+chrxh@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

@copilot alien should be started with non interop mode by default. Change the CLI parameter --no-interop to --interop such that the user must explicitly set interop mode.

Done in c9c3aa2. Changed default to no-interop mode and renamed CLI parameter from --no-interop to --interop. User must now explicitly pass --interop to enable CUDA-OpenGL interop mode.

@chrxh chrxh marked this pull request as ready for review January 5, 2026 08:43
@chrxh chrxh merged commit 12f20b8 into develop Jan 5, 2026
1 check failed
@chrxh chrxh deleted the copilot/add-no-interop-parameter-handling branch January 5, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants