Compare commits

...

3 Commits

Author SHA1 Message Date
Rob Armstrong
940a4c7a91
memMapIpc: Resolve build-time warnings and minor potential issues (#329)
* Fix compute performance calculation type casting in gpuGetMaxGflopsDeviceIdDRV() for #109

* 3_CUDA_Features/memMapIPCDrv: Increase procIdx buffer size to prevent potential buffer overflow

* memMapIPCDrv: Fix memory leaks and improve header inclusion

- Remove redundant string.h header
- Add memory cleanup for dynamically allocated JIT options and log buffer
- Fix printf format specifier for unsigned long long
2025-02-19 15:52:20 -08:00
ohmaya
61bd39800d
simplePrintf.cu: "Compute capability" text (#299)
Compute %d.%d capability => Compute capability %d.%d
2025-02-19 15:22:34 -08:00
Rob Armstrong
8a96d2eee7
Fix compute performance calculation type casting in gpuGetMaxGflopsDeviceIdDRV() for #109 2025-02-19 10:43:18 -08:00
3 changed files with 9 additions and 5 deletions

View File

@ -241,7 +241,7 @@ inline int gpuGetMaxGflopsDeviceIdDRV() {
}
unsigned long long compute_perf =
(unsigned long long)(multiProcessorCount * sm_per_multiproc *
((unsigned long long)multiProcessorCount * sm_per_multiproc *
clockRate);
if (compute_perf > max_compute_perf) {

View File

@ -57,7 +57,7 @@ int main(int argc, char **argv) {
// Get GPU information
checkCudaErrors(cudaGetDevice(&devID));
checkCudaErrors(cudaGetDeviceProperties(&props, devID));
printf("Device %d: \"%s\" with Compute %d.%d capability\n", devID, props.name,
printf("Device %d: \"%s\" with Compute capability %d.%d\n", devID, props.name,
props.major, props.minor);
printf("printf() is called. Output:\n\n");

View File

@ -31,7 +31,6 @@
*/
#include <stdio.h>
#include <string.h>
#include <cstring>
#include <iostream>
#include "cuda.h"
@ -293,6 +292,11 @@ static void memMapGetDeviceFunction(char **argv) {
jitNumOptions, jitOptions,
(void **)jitOptVals));
printf("> PTX JIT log:\n%s\n", jitLogBuffer);
// Clean up dynamically allocated memory
delete[] jitOptions;
delete[] jitOptVals;
delete[] jitLogBuffer;
} else {
checkCudaErrors(cuModuleLoad(&cuModule, module_path.c_str()));
}
@ -379,7 +383,7 @@ static void childProcess(int devId, int id, char **argv) {
// deterministic.
barrierWait(&shm->barrier, &shm->sense, (unsigned int)procCount);
if (id == 0) {
printf("Step %lld done\n", (unsigned long long)i);
printf("Step %llu done\n", (unsigned long long)i);
}
}
@ -550,7 +554,7 @@ static void parentProcess(char *app) {
// Launch the child processes!
for (i = 0; i < nprocesses; i++) {
char devIdx[10];
char procIdx[10];
char procIdx[12];
char *const args[] = {app, devIdx, procIdx, NULL};
Process process;