Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zzqbranch #341

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/solver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
RUN chmod 755 /ansys_inc/
29 changes: 14 additions & 15 deletions src/ansys/dyna/core/solver/dynasolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down
Loading