nsight.nvim is a Neovim plugin that provides seamless integration with NVIDIA Nsight profiling tools. It allows you to manage CUDA profiling sessions, run various NVIDIA tools, and analyze profiling results without leaving your editor.
- Neovim (v0.9.0 or higher)
- NVIDIA CUDA Toolkit:
nvcc: NVIDIA CUDA Compilernvvp: NVIDIA Visual Profilerncu: NVIDIA Nsight Computensys: NVIDIA Nsight Systems
Using lazy.nvim
{
"Jorgedavyd/nsight.nvim",
config = function()
require("nsight").setup({
-- Your configuration here
})
end,
}Using packer.nvim
use {
"Jorgedavyd/nsight.nvim",
config = function()
require("nsight").setup({
-- Your configuration here
})
end
}Using vim-plug
Plug 'Jorgedavyd/nsight.nvim'
" After installation, in your init.lua:
" lua require('nsight').setup({})Using dein.vim
call dein#add('Jorgedavyd/nsight.nvim')
" After installation, in your init.lua:
" lua require('nsight').setup({})require("nsight").setup({
session = {
window = {
title = "Nsight Session",
title_pos = "left",
width_in_columns = 12,
height_in_lines = 8,
style = "minimal",
border = "single"
},
keymaps = function(bufnr)
-- Define your keymaps here
end,
resolve_triggers = {}
},
extensions = {
telescope = {},
sqlite = {},
cli = {}
}
})- Session Management: Create and manage CUDA profiling sessions
- File Integration: Add CUDA source files to your profiling session
- Tool Integration: Run NVIDIA profiling tools directly from Neovim
- Report Analysis: View and analyze profiling reports
- Project Management: Organize profiling experiments per project
| Command | Description |
|---|---|
NsightActivate |
Activate the profiling session |
NsightDeactivate |
Deactivate the profiling session |
NsightToggle |
Toggle the profiling session |
Nvcc |
Run NVIDIA CUDA Compiler |
Ncu |
Run NVIDIA Nsight Compute |
Nvvp |
Run NVIDIA Visual Profiler |
Nsys |
Run NVIDIA Nsight Systems |
NsysUi |
Open NVIDIA Nsight Systems UI |
NcuUi |
Open NVIDIA Nsight Compute UI |
| Function | Description |
|---|---|
toggle_include() |
Include the current buffer's filepath in the session |
toggle_view() |
Open the interactive session window |
The plugin integrates with Telescope for enhanced file selection and report browsing:
-- Add to your telescope configuration
telescope.load_extension('nsight')
-- Usage
:Telescope nsight file_add_cuda -- Find and add CUDA files to session
:Telescope nsight nsys_open_report -- Open Nsight Systems reports
:Telescope nsight ncu_open_report -- Open Nsight Compute reportsnsight.nvim creates a .nsight.nvim directory in your project root to store profiling experiments and configurations. Experiments are organized based on the files being profiled.
.nsight.nvim/
├── .config # Session configuration
└── experiments/
└── file1_file2/ # Experiment for specific files
├── report1/ # Profiling report
├── report2/
└── .history # Experiment history
-- In your init.lua
require("nsight").setup()
-- In Neovim
:NsightToggle -- Open the profiler window
-- Add CUDA files to the session
:NsightDeactivate -- Save the session
:Nvcc -o output main.cu -- Compile a CUDA file
:Nsys profile ./output -- Profile the compiled binary
:Telescope nsight nsys_open_report -- View the reportrequire("nsight").setup({
session = {
keymaps = function(bufnr)
-- Define keymaps for the profiler buffer
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<CR>',
"<cmd>lua require('nsight').toggle_include()<CR>",
{ noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'q',
"<cmd>lua require('nsight.ui').close_menu()<CR>",
{ noremap = true, silent = true })
end
}
})Contributions are welcome! Check out the todo.md file for planned features and improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
