cocluto v1.03:

- added Inventory methods related to gpus
- added a missing dependency (mysqlclient); nb this change dates back from a few months.

work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3945]
This commit is contained in:
Guillaume Raffy 2024-09-17 18:49:33 +02:00
parent 9f4a80b11e
commit e86197c083
2 changed files with 24 additions and 3 deletions

View File

@ -1,4 +1,5 @@
# encoding: utf-8
from typing import List
import datetime
# from Lib import SimpaDbUtil
from . import SimpaDbUtil
@ -147,7 +148,7 @@ class Inventory(object):
slot_index = self._sql_reader.get_table_attr('rackable_machine_to_location', 'machine_id', machine_id, 'slot_index')
return rack_id, slot_index
def get_cpu_dflops(self, cpu_model):
def get_cpu_dflops(self, cpu_model) -> float:
'''
returns the number of double precision operation per second this cpu can achieve
'''
@ -159,9 +160,29 @@ class Inventory(object):
# print(num_cores, clock_speed, dflops_per_core_per_cycle)
return clock_speed * dflops_per_core_per_cycle * num_cores
def get_gpu_ram(self, gpu_id: str) -> float:
mib_to_bytes = 1024 * 1024
gpu_model_id = self.machine_name_to_machine_spec_id(gpu_id)
ram_size = int(self._sql_reader.get_table_attr('gpu_specs', 'gpu_model_id', gpu_model_id, 'ram_mib')) * mib_to_bytes
return ram_size
def get_gpu_dflops(self, gpu_id: str) -> float:
gpu_model_id = self.machine_name_to_machine_spec_id(gpu_id)
dflops = int(self._sql_reader.get_table_attr('gpu_specs', 'gpu_model_id', gpu_model_id, 'peak_dgflops'))
return dflops
def get_num_cpus(self, computer_name):
return int(self._sql_reader.get_table_attr('computer_to_cpu', 'computer_id', computer_name, 'num_cpu'))
def get_gpus(self, computer_id: str) -> List[str]:
'''returns the gpu_ids of the gpus installed in the given computer'''
gpu_ids = []
rows = self._sql_reader.query("SELECT gpu_id FROM gpu_to_computer WHERE computer_id='%s'" % computer_id)
for row in rows:
gpu_id = row[0]
gpu_ids.append(gpu_id)
return gpu_ids
def get_num_cores(self, computer_name):
num_cpus = int(self._sql_reader.get_table_attr('computer_to_cpu', 'computer_id', computer_name, 'num_cpu'))
cpu_model = self._sql_reader.get_table_attr('computer_to_cpu', 'computer_id', computer_name, 'cpu_model')

View File

@ -2,12 +2,12 @@ from setuptools import setup
setup(
name='cocluto',
version=1.02,
version=1.03,
description='compute cluster utility tools',
url='https://git.ipr.univ-rennes1.fr/graffy/cocluto',
author='Guillaume Raffy',
author_email='guillaume.raffy@univ-rennes1.fr',
license='MIT',
packages=['cocluto'],
install_requires=['pygraphviz'], # requires apt install graphviz-dev
install_requires=['pygraphviz', 'mysqlclient'], # requires apt install graphviz-dev
zip_safe=False)