Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ NVFD is an open-source NVIDIA GPU fan control daemon for Linux. It uses the NVML
- Fixed fan speed mode
- True auto mode (returns control to NVIDIA driver)
- Multi-GPU support with per-GPU or all-GPU control, adaptive full/tabbed display
- Per-GPU mode switching via CLI (`nvfd 0 auto`, `nvfd 1 curve`, etc.)
- Real-time temperature, utilization, memory, and power monitoring
- Systemd service with automatic fan reset on shutdown
- Config hot-reload via SIGHUP
Expand Down Expand Up @@ -110,6 +111,9 @@ nvfd curve edit Interactive curve editor (ncurses)
nvfd curve reset Reset fan curve to default
nvfd <speed> Set fixed fan speed for all GPUs (30-100)
nvfd <gpu_index> <speed> Set fixed fan speed for specific GPU
nvfd <gpu_index> auto Set specific GPU to auto mode
nvfd <gpu_index> curve Set specific GPU to curve mode
nvfd <gpu_index> manual <speed> Set specific GPU to fixed speed
nvfd list List all GPUs and their indices
nvfd status Show current status
nvfd -h Show help
Expand Down Expand Up @@ -169,6 +173,11 @@ nvfd 0 60
# Return all fans to driver control
nvfd auto

# Per-GPU mode control
nvfd 0 auto # Set GPU 0 to auto mode
nvfd 1 curve # Set GPU 1 to curve mode
nvfd 0 manual 70 # Set GPU 0 to manual mode at 70%

# Use custom fan curve
nvfd curve
nvfd curve show
Expand Down
6 changes: 6 additions & 0 deletions src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ void display_help(void) {
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd <gpu_index> <speed> | Set fixed fan speed for specific GPU |\n");
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd <gpu_index> auto | Set specific GPU to auto mode |\n");
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd <gpu_index> curve | Set specific GPU to curve mode |\n");
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd <gpu_index> manual <sp> Set specific GPU to fixed speed |\n");
Comment thread
delwiv marked this conversation as resolved.
Outdated
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd list | List all GPUs and their indices |\n");
printf("+-----------------------------+-----------------------------------------+\n");
printf("| nvfd status | Show current status |\n");
Expand Down
43 changes: 43 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,49 @@ int main(int argc, char *argv[]) {
} else {
printf("Invalid GPU index. Use 'nvfd list' to see available GPUs.\n");
}
} else if (argc == 3 && gpu_index >= 0 && gpu_index < (int)device_count) {
/* Per-GPU mode: nvfd <gpu_index> auto|curve */
Comment thread
delwiv marked this conversation as resolved.
Outdated
if (strcmp(argv[2], "auto") == 0) {
char gpu_key[20];
snprintf(gpu_key, sizeof(gpu_key), "gpu%d", gpu_index);
config_write_gpu(gpu_key, "auto", 0);
fan_reset_to_auto((unsigned int)gpu_index);
printf("GPU %d set to auto mode (driver-controlled).\n", gpu_index);
} else if (strcmp(argv[2], "curve") == 0) {
char gpu_key[20];
Comment thread
delwiv marked this conversation as resolved.
Outdated
snprintf(gpu_key, sizeof(gpu_key), "gpu%d", gpu_index);
config_write_gpu(gpu_key, "curve", 0);
printf("GPU %d set to curve mode.\n", gpu_index);
} else if (strcmp(argv[2], "manual") == 0) {
printf("Invalid command. Use 'nvfd <gpu_index> manual <speed>' for manual mode.\n");
display_help();
gpu_shutdown();
return 1;
} else {
printf("Invalid command or arguments.\n");
display_help();
}
} else if (argc == 4) {
/* Per-GPU manual mode: nvfd <gpu_index> manual <speed> */
gpu_index = atoi(argv[1]);
if (strcmp(argv[2], "manual") == 0 && gpu_index >= 0 && gpu_index < (int)device_count) {
Comment thread
delwiv marked this conversation as resolved.
Outdated
speed = atoi(argv[3]);
if (speed >= 30 && speed <= 100) {
char gpu_key[20];
snprintf(gpu_key, sizeof(gpu_key), "gpu%d", gpu_index);
config_write_gpu(gpu_key, "manual", speed);
fan_set_gpu_speed((unsigned int)gpu_index, (unsigned int)speed);
printf("GPU %d set to fixed speed %d%%.\n", gpu_index, speed);
} else {
printf("Invalid speed. Use a value between 30 and 100.\n");
display_help();
}
} else {
printf("Invalid command: %s\n", argv[2]);
display_help();
gpu_shutdown();
return 1;
}
} else {
printf("Invalid speed. Use a value between 30 and 100.\n");
display_help();
Expand Down