-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVel_Operations.py
More file actions
29 lines (27 loc) · 1.15 KB
/
Vel_Operations.py
File metadata and controls
29 lines (27 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import ctypes
import platform
from ctypes import *
import tkinter as tk
from tkinter import messagebox
def vrms2vint(input_type, file_list):
lib_name = ""
current_os = platform.system()
if(current_os == "Linux"):
current_machine = platform.machine()
if(current_machine == "x86_64"):
lib_name = "./FileOps_GPU_Operations-x86_64.so"
elif(current_machine == "aarch64"):
lib_name = "./FileOps_GPU_Operations-aarch64.so"
elif(current_os == "Windows"):
lib_name = "./FileOps_GPU_Operations.dll"
elif(current_os == "Darwin"):
lib_name = "./FileOps_GPU_Operations.bundle"
lib_gpuops = cdll.LoadLibrary(lib_name)
if(lib_gpuops.has_CUDA30_GPU() == 0):
for file_name in file_list:
if(lib_gpuops.Vrms2Vint(ctypes.c_char(input_type.encode('utf-8')), (file_name).encode('utf-8'), \
(os.path.splitext(file_name)[0] + "_converted_to_Vint" + os.path.splitext(file_name)[1]).encode('utf-8')) != 0):
tk.messagebox.showerror("Vrms -> Vint", "Unable to process file " + file_name + ", check the terminal for more information on the error.")
else:
tk.messagebox.showerror("GPU error", "No CUDA 3.0+ NVidia card present. Unable to run GPU operations.")