[v0.01] Adding and creating basic source code base taken from cpufetch
This commit is contained in:
19
src/cuda/cuda.cpp
Normal file
19
src/cuda/cuda.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <helper_cuda.h>
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
#include "cuda.hpp"
|
||||
#include "../common/global.hpp"
|
||||
|
||||
struct gpu_info* get_gpu_info() {
|
||||
struct gpu_info* gpu = (struct gpu_info*) emalloc(sizeof(struct gpu_info));
|
||||
|
||||
int dev = 0;
|
||||
cudaSetDevice(dev);
|
||||
cudaDeviceProp deviceProp;
|
||||
cudaGetDeviceProperties(&deviceProp, dev);
|
||||
|
||||
gpu->name = (char *) emalloc(sizeof(char) * (strlen(deviceProp.name) + 1));
|
||||
strcpy(gpu->name, deviceProp.name);
|
||||
|
||||
return gpu;
|
||||
}
|
||||
8
src/cuda/cuda.hpp
Normal file
8
src/cuda/cuda.hpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __CUDA__
|
||||
#define __CUDA__
|
||||
|
||||
#include "../common/gpu.hpp"
|
||||
|
||||
struct gpu_info* get_gpu_info();
|
||||
|
||||
#endif
|
||||
37
src/cuda/uarch.cpp
Normal file
37
src/cuda/uarch.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
typedef uint32_t MICROARCH;
|
||||
|
||||
// Data not available
|
||||
#define NA -1
|
||||
|
||||
// Unknown manufacturing process
|
||||
#define UNK -1
|
||||
|
||||
enum {
|
||||
UARCH_UNKNOWN,
|
||||
UARCH_TESLA
|
||||
};
|
||||
|
||||
struct uarch {
|
||||
MICROARCH uarch;
|
||||
char* uarch_str;
|
||||
int32_t process;
|
||||
};
|
||||
|
||||
struct uarch* get_uarch_from_cuda(struct gpu_info* gpu) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* get_str_uarch(struct gpu_info* gpu) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* get_str_process(struct gpu_info* gpu) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void free_uarch_struct(struct uarch* arch) {
|
||||
|
||||
}
|
||||
11
src/cuda/uarch.hpp
Normal file
11
src/cuda/uarch.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef __UARCH__
|
||||
#define __UARCH__
|
||||
|
||||
struct uarch;
|
||||
|
||||
struct uarch* get_uarch_from_cuda(struct gpu_info* gpu);
|
||||
char* get_str_uarch(struct gpu_info* gpu);
|
||||
char* get_str_process(struct gpu_info* gpu);
|
||||
void free_uarch_struct(struct uarch* arch);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user