Skip to content

Commit

Permalink
Merge branch 'master' into feat/GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
bozhang-hpc committed May 21, 2024
2 parents 3263ead + 3370123 commit 26704f5
Show file tree
Hide file tree
Showing 7 changed files with 322 additions and 88 deletions.
25 changes: 25 additions & 0 deletions bindings/python/dspaces.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from dataclasses import dataclass
from dspaces.dspaces_wrapper import *
import numpy as np
import dill as pickle

@dataclass
class DSObject:
name: str
version: int
lb: tuple[int, ...]
ub: tuple[int, ...]

class DSServer:
def __init__(self, conn = "sockets", comm = None, conf = "dataspaces.conf"):
from mpi4py import MPI
Expand Down Expand Up @@ -64,6 +72,23 @@ def Exec(self, name, version, lb=None, ub=None, fn=None):
def DefineGDim(self, name, gdim):
wrapper_dspaces_define_gdim(self.client, (self.nspace + name).encode('ascii'), gdim)

def GetVars(self):
return wrapper_dspaces_get_vars(self.client)

def GetObjVars(self, var_name):
ret_objs = []
wrapper_results = wrapper_dspaces_get_var_objs(self.client, var_name.encode('ascii'))
for obj in wrapper_results:
ret_objs.append(
DSObject(
name = obj['name'],
version = obj['version'],
lb = obj['lb'],
ub = obj['ub']
)
)
return(ret_objs)

def _get_expr(obj, client):
if isinstance(obj, DSExpr):
return(obj)
Expand Down
Loading

0 comments on commit 26704f5

Please sign in to comment.