You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							33 lines
						
					
					
						
							604 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							33 lines
						
					
					
						
							604 B
						
					
					
				
								#include "utility.h"
							 | 
						|
								
							 | 
						|
								#include <cuda_runtime.h>
							 | 
						|
								
							 | 
						|
								size_t getFreeCudaMemory() {
							 | 
						|
									size_t freeMemory;
							 | 
						|
									size_t totalMemory;
							 | 
						|
									cudaMemGetInfo(&freeMemory, &totalMemory);
							 | 
						|
								
							 | 
						|
									return freeMemory;
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								size_t getTotalCudaMemory() {
							 | 
						|
									size_t freeMemory;
							 | 
						|
									size_t totalMemory;
							 | 
						|
									cudaMemGetInfo(&freeMemory, &totalMemory);
							 | 
						|
								
							 | 
						|
									return totalMemory;
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								bool resetCudaDevice() {
							 | 
						|
									cudaError_t result = cudaDeviceReset();
							 | 
						|
									return (result == cudaSuccess);
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								int getRuntimeCudaVersion() {
							 | 
						|
									int result = -1;
							 | 
						|
									cudaError_t errorResult = cudaRuntimeGetVersion(&result);
							 | 
						|
									if (errorResult != cudaSuccess) {
							 | 
						|
										return -1;
							 | 
						|
									}
							 | 
						|
									return result;
							 | 
						|
								}
							 |