[v0.01] Defining a first approach of the application general structure

This commit is contained in:
Dr-Noob
2021-08-11 11:34:47 +02:00
parent 7b88845d71
commit a15f20a2cc
8 changed files with 129 additions and 3 deletions

View File

@@ -2,18 +2,62 @@
#include <cuda_runtime.h>
#include "cuda.hpp"
#include "uarch.hpp"
#include "../common/global.hpp"
struct cache* get_cache_info(struct gpu_info* gpu) {
struct cache* cach = (struct cache*) emalloc(sizeof(struct cache));
return cach;
}
struct topology* get_topology_info(struct gpu_info* gpu) {
struct topology* topo = (struct topology*) emalloc(sizeof(struct topology));
return topo;
}
struct memory* get_memory_info(struct gpu_info* gpu) {
struct memory* mem = (struct memory*) emalloc(sizeof(struct memory));
return mem;
}
int64_t get_peak_performance(struct gpu_info* gpu) {
return 1000;
}
struct gpu_info* get_gpu_info() {
struct gpu_info* gpu = (struct gpu_info*) emalloc(sizeof(struct gpu_info));
printf("Waiting for CUDA driver to start...\n");
int dev = 0;
cudaSetDevice(dev);
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);
gpu->vendor = GPU_VENDOR_NVIDIA;
gpu->name = (char *) emalloc(sizeof(char) * (strlen(deviceProp.name) + 1));
strcpy(gpu->name, deviceProp.name);
gpu->freq = 10000;
gpu->arch = get_uarch_from_cuda(gpu);
gpu->cach = get_cache_info(gpu);
gpu->topo = get_topology_info(gpu);
gpu->peak_performance = get_peak_performance(gpu);
return gpu;
}
char* get_str_sm(struct gpu_info* gpu) {
return NULL;
}
char* get_str_cores_sm(struct gpu_info* gpu) {
return NULL;
}
char* get_str_cuda_cores(struct gpu_info* gpu) {
return NULL;
}

View File

@@ -4,5 +4,8 @@
#include "../common/gpu.hpp"
struct gpu_info* get_gpu_info();
char* get_str_sm(struct gpu_info* gpu);
char* get_str_cores_sm(struct gpu_info* gpu);
char* get_str_cuda_cores(struct gpu_info* gpu);
#endif

View File

@@ -28,6 +28,10 @@ char* get_str_uarch(struct gpu_info* gpu) {
return NULL;
}
char* get_str_cc(struct gpu_info* gpu) {
return NULL;
}
char* get_str_process(struct gpu_info* gpu) {
return NULL;
}

View File

@@ -5,6 +5,7 @@ struct uarch;
struct uarch* get_uarch_from_cuda(struct gpu_info* gpu);
char* get_str_uarch(struct gpu_info* gpu);
char* get_str_cc(struct gpu_info* gpu);
char* get_str_process(struct gpu_info* gpu);
void free_uarch_struct(struct uarch* arch);