diff --git a/docker/solver/Dockerfile b/docker/solver/Dockerfile index 3e60a31e9..4bdfbb058 100644 --- a/docker/solver/Dockerfile +++ b/docker/solver/Dockerfile @@ -17,6 +17,7 @@ RUN yum -y install openssh-clients openssh-server bind-utils sudo python3 RUN python3 -m pip install --upgrade pip RUN python3 -m pip install grpcio RUN python3 -m pip install grpcio-tools +RUN python3 -m pip install protobuf==4.21.0 # ENV USER mpirun ENV HOME /home/mpirun @@ -85,4 +86,4 @@ COPY mpi /opt/openmpi # ifort runtime libraries in /ansys_inc/lib COPY docker_dir /ansys_inc -RUN chmod 755 /ansys_inc/server.py \ No newline at end of file +RUN chmod 755 /ansys_inc/ \ No newline at end of file diff --git a/src/ansys/dyna/core/solver/dynasolver.py b/src/ansys/dyna/core/solver/dynasolver.py index 5015283f8..e3d8a2c25 100644 --- a/src/ansys/dyna/core/solver/dynasolver.py +++ b/src/ansys/dyna/core/solver/dynasolver.py @@ -12,7 +12,7 @@ import threading from time import sleep -from ansys.api.dyna.v0 import dynasolver_pb2 +from ansys.api.dyna.v0 import dynasolver_pb2, dynasolver_pb2_grpc import grpc from . import grpc_tags as tag @@ -100,8 +100,8 @@ def __init__(self, hostname, port, server_path=""): logging.critical("Can not connect to Solver Server") sys.exit() logging.info("Connected to Solver Server...") - # self.stub = dynasolver_pb2_grpc.DynaSolverCommStub(self.channel) - self.stub = DynaSolverCommStub(self.channel) + self.stub = dynasolver_pb2_grpc.DynaSolverCommStub(self.channel) + # self.stub = DynaSolverCommStub(self.channel) # if DynaSolver.logger is None: # DynaSolver.logger = logging.getLogger("DynaSolver") # DynaSolver.logger.setLevel(logging.INFO) @@ -304,8 +304,8 @@ def upload(self, fname): def push_packets(fname): nonlocal fsize - # request = dynasolver_pb2.DynaSolverFileData() - request = DynaSolverFileData() + request = dynasolver_pb2.DynaSolverFileData() + # request = DynaSolverFileData() # Only send the base file name, not the whole path! bfname = os.path.split(fname)[1] request.b = bytes(bfname, "utf-8") @@ -314,8 +314,8 @@ def push_packets(fname): blocksize = 1000000 n = blocksize while n == blocksize: - # request = dynasolver_pb2.DynaSolverFileData() - request = DynaSolverFileData() + request = dynasolver_pb2.DynaSolverFileData() + # request = DynaSolverFileData() request.b = fp.read(blocksize) n = len(request.b) fsize = fsize + n @@ -389,8 +389,8 @@ def run(self, args): Command line to pass to LS-DYNA. """ self.logger.debug("run: %s" % args) - # request = dynasolver_pb2.DynaSolverRelay() - request = DynaSolverRelay() + request = dynasolver_pb2.DynaSolverRelay() + # request = DynaSolverRelay() request.tag = tag.RUN request.b = bytes(args, "utf-8") response = self.stub.send_request(request) @@ -424,7 +424,7 @@ def setlc(self, lc, value): self._check_return(response) return - def start(self, nproc, solver_fname=""): + def start(self, nproc): """Start LS-DYNA. The program starts and awaits further input. To begin a @@ -440,10 +440,9 @@ def start(self, nproc, solver_fname=""): Number of cores (MPI ranks) to run. """ self.logger.debug("start: %d" % nproc) - # request = dynasolver_pb2.DynaSolverStart() - request = DynaSolverStart() - # request.exename = b"mppdyna" - request.exename = bytes(solver_fname, "utf-8") + request = dynasolver_pb2.DynaSolverStart() + # request = DynaSolverStart() + request.exename = b"mppdyna" request.nproc = nproc response = self.stub.start_solver(request) if response.status == tag.RUNNING: @@ -460,7 +459,7 @@ def start_locally(self, preset="MPP_DOUBLE", input="", nproc=1, memory=20): """ self.logger.debug("start: %d" % nproc) - request = DynaSolverStartLocal() + request = dynasolver_pb2.DynaSolverStartLocal() request.preset = bytes(preset, "utf-8") request.input = bytes(input, "utf-8") request.nproc = nproc