Replies: 9 comments 4 replies
-
|
Hi, thanks for sharing this. As a heads up, I'm currently at a conference (AIAA SciTech), so there's a lot going on. I will try to take a look at it as soon as I have time and try to help you debug the issue (or see if there is an issue with philote). I have seen the unimplemented error before in a few different contexts. It can be a bit misleading in terms of what the root cause is. In the mean time, could you provide the philote-python version that you are using? If you aren't using a release version, could you let me know the git hash of the commit that you are working off of? Thanks. It will help pinpoint things (and whether I may have fixed something already but not release the version yet). |
Beta Was this translation helpful? Give feedback.
-
|
Thank you, Chris. Have a great time at SciTech. I installed the latest available version, 0.6.1, from Git. I will look into it more thoroughly from my side and will discuss it when you are available after the conference. Thank you. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry for the delay. I'm having some difficulty discerning what your main goal is. My first question is, is there a reason you are implementing your own client wrapper for OpenMDAO? Philote-Python does provide an OpenMDAO implementation for explicit and implicit components. If you are trying to prototype for another framework, I suggest using those components as a starting point. Unfortunately, it looks like the actual discipline implementations are not included in the code. Therefore, I can't actually test the code to see if there is something causing the issue within the defined Philote discipline implementation. Depending on what you are trying to achieve, I would suggest initially creating a simpler problem and then adding complexity once parts work. If you are trying to test your custom client wrapper, I would suggest testing that against the examples provided in Philote-Python. If you are trying to debug the remote philote servers, I would recommend starting with a single discipline and debugging it until it works, before adding in additional servers. I can try to run it if you could simplify it down to a single discipline and provide all the files needed to run. I understand that not all disciplines can be shared, but I'm ok working with toy problems if that helps. If you do that, could you do me a favor and upload the files instead of pasting them into the textbox (because it's markdown, it makes the files very hard to follow)? |
Beta Was this translation helpful? Give feedback.
-
|
Hello Chris, Thank you for the update. The reason I tried to use a client wrapper is that I have several modules (python files) that I want to call. And I have one main run file for calling all the modules. |
Beta Was this translation helpful? Give feedback.
-
|
Now, I assume I own two modules on my server (Aerodynamics and Structure), and the client has other modules, such as Propulsion, Performance Modules, etc. To run the MDA loop, the client needs access to my modules. The tool has one main run file, ssbj_mda, that can be used to run the whole framework. I created a Philote Server file for my two modules, and I pushed these on gRPC and made them available for the client, and then I created a Philote Client file asking for these two modules, and I am testing it on the same machine. client.txt I tried all the examples (including the Parabloid one and followed a similar procedure, and it worked). I followed the same procedure for this SSBJ problem and my guess is when the client runs the file, it can not access all the variables and values because there are multiple files and I checked the port connections etc, and they are active and exist and therefore, I do not think any issue from that side. Could you please look into all these files and guide me accordingly? Thank you. Regards, |
Beta Was this translation helpful? Give feedback.
-
|
Ok, I've simplified the problem somewhat, only using the performance discipline as a server and calling it from OpenMDAO (via the built-in client). Here is the revised (and simplified) performance discipline (performance.py): The key line being: as this is not an OpenMDAO discipline. I did remove the scalers to make this easier to understand. However, you can add the scalers in as options (if you need help with that, let's open another discussion/topic). Next, run the server (server.py): Finally, let's create an OpenMDAO problem and run the remote discipline from it (run.py): This works for me (using the Philote-Python OpenMDAO wrapper component). You can do this for multiple different servers as well (just use different ports). I know that's a lot simpler than the example you uploaded, but I think it's easier to convey the workflow with it. Let me know if you have more questions regarding this. Also, if you need help setting up options for the discipline, feel free to start a new discussion/thread. |
Beta Was this translation helpful? Give feedback.
-
|
I left out the partials in the example to make it simpler. Obviously, if you are doing gradient-based optimization, you'd have to provide them. |
Beta Was this translation helpful? Give feedback.
-
|
@pymusa-09, does this address your issue? |
Beta Was this translation helpful? Give feedback.
-
|
Thank you, Chris, for the comprehensive explanation. Firstly, I mean to say, in MDAO Frameworks, if we have a large number of files, changing each class to pmdo may be tricky (and I know the Component class is always there for OpenMDAO and some other class types for codes not in OpenMDAO framework). The other reason is collaborative architectures; the codes can be written in different frameworks. My aircraft sizing tool is in the OpenMDAO framework, and my collaborator's code may be in another, so changing classes may be tricky. Again, it is doable, and I understand that. "Regarding the aircraft sizing tool. From your comment, to me it sounds like you want to call the entire sizing tool from Philote and run it remotely."......exactly, this is what I intend to do. I am using OpenMDAO, and it would be great if I could do it changing the main file only. I will create the discipline class for my main run file and then see how it works. I will keep you updated. Thank you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am learning Philote for the remote execution of MDO frameworks, where the work packages from different users can be written in different frameworks or different structures, or sometimes computational software.
So, starting from learning the basics of Philote for the SSBJ Case study, it has four modules (Aerodynamics, Structure, Propulsion and Performance). Let us assume I can access two modules in my server (Aerodynamics and Structure), and the client has Propulsion and Performance Modules. To run the MDA loop, the client needs access to my tools.
So, I created the server ports and made my work modules available to gRPC. I created server and client codes on the same local machine for a simple case study.
server.py
from concurrent import futures
import grpc
import philote_mdo.general as pmdo
from ssbj_disciplines.aerodynamics import Aerodynamics # Import aerodynamic module
from ssbj_disciplines.structure import Structure # Import structure module
import numpy as np
Define scalers for the disciplines
scalers = {
'z': np.array([0.05, 45000., 1.6, 5.5, 55.0, 1000.0]),
'WT': 49909.58578,
'ESF': 1.0,
'Theta': 0.950978,
'D': 12193.7018,
'fin': 4.093062,
'dpdx': 1.0,
}
Aerodynamics Server
def start_aero_server():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
discipline = pmdo.ExplicitServer(discipline=Aerodynamics(scalers)) # Pass scalers
discipline.attach_to_server(server)
server.add_insecure_port("0.0.0.0:60051") # Aerodynamics server on port 50051
server.start()
print("Aerodynamics server running on port 60051")
server.wait_for_termination()
Structure Server
def start_structure_server():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
discipline = pmdo.ExplicitServer(discipline=Structure(scalers)) # Pass scalers
discipline.attach_to_server(server)
server.add_insecure_port("0.0.0.0:60051:60052") # Structure server on port 50052
server.start()
print("Structure server running on port 60052")
server.wait_for_termination()
if name == "main":
import multiprocessing
client.py
from future import print_function
from six import iterkeys
import numpy as np
from openmdao.api import ExecComp, IndepVarComp, Group, Problem, NonlinearBlockGS, ScipyKrylov
from ssbj_disciplines.performance import Performance
from ssbj_disciplines.propulsion import Propulsion
from philote_client_wrapper import PhiloteClientWrapper
class SSBJ_MDA(Group):
"""
SSBJ Analysis with aerodynamics, performance, propulsion, and structure disciplines.
"""
def init(self, scalers):
super().init()
self.scalers = scalers
def init_ssbj_mda():
"""
Initialize and run the SSBJ MDA analysis.
"""
prob = Problem()
if name == "main":
scalers = init_ssbj_mda()
import grpc
from openmdao.api import ExplicitComponent
from philote_mdo.general import ExplicitClient
class PhiloteClientWrapper(ExplicitComponent):
"""
OpenMDAO-compatible wrapper for Philote ExplicitClient.
"""
def init(self, host, port, variable_defs):
super().init()
self.host = host
self.port = port
self.client = ExplicitClient(channel=grpc.insecure_channel(f"{host}:{port}"))
self.variable_defs = variable_defs # Input/output definitions for the discipline
so, when I am running as a Client, it gives me error StatusCode.UNIMPLEMENTED, indicating the server did not recognize the method invoked by the client.
Beta Was this translation helpful? Give feedback.
All reactions