-
Notifications
You must be signed in to change notification settings - Fork 182
Add --no-interop parameter to disable CUDA-OpenGL interoperability #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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>
| syncAndCheck(); | ||
|
|
||
| // Copy from device to host and upload to OpenGL | ||
| if (numRenderObjects.cells > 0) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 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>
Added in c38c52f. Created |
source/EngineTests/GeometryTests.cpp
Outdated
|
|
||
| INSTANTIATE_TEST_SUITE_P(InteropModes, GeometryTests, ::testing::Values(false, true)); | ||
|
|
||
| TEST_P(GeometryTests, getNumRenderObjects_emptySim) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 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>
Fixed in b183260. Simplified |
|
@copilot alien should be started with non interop mode by default. Change the CLI parameter |
- 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>
Done in c9c3aa2. Changed default to no-interop mode and renamed CLI parameter from |
noInteropsetting to GlobalSettings (defaults to true)--interopcommand line argument in GUI Main.cpp (enables interop mode)CudaGeometryBuffersto support non-interop mode with CPU/GPU memory transfersGeometryKernelsService::extractObjectDatato handle both interop and non-interop modes (no separate method)SimulationCudaFacade::copyBuffersFromCudaToOpenGL- delegate buffer details to CudaGeometryBuffers_GeometryBuffersclass to support uploading from host memoryUsage
./alien(runs in no-interop mode, uses CPU-GPU memory transfers)./alien --interop(uses CUDA-OpenGL interop for rendering)Original prompt
💡 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.