How to run MPI-compatible applications from Jupyter laptops?

So I have a troll with gmsh .

Direct execution works fine:

 !gmsh -3 -algo meshadapt tmp_0.geo -o SFM.msh 

While execution from code is not executed:

 try: out = subprocess.check_output( ["gmsh", "gmsh -3 -algo meshadapt tmp_0.geo -o SFM.msh"], stderr=subprocess.STDOUT ).strip().decode('utf8') except subprocess.CalledProcessError as e: out = e.output print(out) 

with:

b "--------------------------------------------- --- -------------------------- \ n [[23419.1], 0]: MPI high-performance open access point to-threaded messaging module \ nwas could not find the appropriate network interfaces: \ n \ nModule: OpenFabrics (openib) \ n Host: 931136e3f6fe \ n \ nWhen using another transport instead, although this may lead to \ n lower performance. \ n --- ------------------------------------------- ------- --------------------- \ n \ x1b [1m \ x1b [31mFatal: cannot open the display: (FLTK internal error) \ X1B [0m \ n --- --------------------------------------- ----------- --------------------- \ nMPI_ABORT is called at rank 0 in the communicator MPI_COMM_WORLD \ n with error code 1. \ n \ nNOTE: calling MPI_ABORT causes Open MPI to kill all MPI processes. \ NYou can see or not see the output from other processes, depending on \ nexactly when Open MPI kills them. \ n ---------------------------------------------- ---- ------------------------\P"

So how to emulate execution ! in jupyter from python 3 code?


@Hristo:

_ = / opt / conda / bin / jupyter SHLVL = 1 PATH = / opt / conda / bin: / opt / conda / bin: / usr / local / sbin: / usr / local / bin: / usr / sbin: / USR / bin: / SBIN: / bin HOSTNAME = 931136e3f6fe HOME = / root LC_ALL = C.UTF-8 PWD = / JPY_PARENT_PID = 1 LANG = C.UTF-8 TERM = xterm-color CLICOLOR = 1 PAGER = cat GIT_PAGER = cat MPLBACKEND = module: //ipykernel.pylab.backend_inline env DISPLAY =: 0 gmsh -3 -algo meshadapt tmp_0.geo -o SFM.msh

@Gilles: The same result.

+5
source share
1 answer

It seems that the main reason is that the $DISPLAY environment variable is not set.

first make sure $DISPLAY installed when you start your Jupyter laptop. You may also need to direct mpirun to export it to all MPI tasks.

starting with Open MPI 3.0.0, you can achieve this with export OMPI_MCA_mca_base_env_list=DISPLAY before working with a Jupyter laptop

By the way, should your application open the X screen? If it does not make graphics, then it can be adjusted to work properly when the display is not available.

[ADDITION]

Another possibility is that gmsh considers the display to be accessible since DISPLAY installed, so it tries to open it and fails. You can try to disable this environment variable and see how everything happens, both from the command line (for example, in interactive mode), and through a laptop (for example, batch mode)

+1
source

Source: https://habr.com/ru/post/1271844/


All Articles