can't open yade when I have already opened 64 yade

Asked by dan.wang

HI

what i did is building DEM model on element's Gauss point, for each element, i have 4 Gauss point, so I need open 4 YADE, now I have 20 elements, so i need to open 80 Yade.
However, it shows error when I have opened 64(or 65) Yade, the error shows:"Maximum number of clients reachedxterm: Xt error: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedxterm: Xt error: Can't open display: :0
xterm: Xt error: Can't open display: :0"

SO it says I meet the maxinum number of clients. And the question is, can I change it and how?

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
dan.wang
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,
please be more specific what "open yade" means. Import yade to a Python script? Open yade from shell (which command)?...
Cheers
Jan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

>Can't open display: :0

Sounds like you are trying to get 64+ graphical renderings... any "qt" related code in the script (even some import)?
B

Revision history for this message
Jérôme Duriez (jduriez) said :
#3

Hi,

As a remark, which may or not suit your needs, did you consider using different scenes in the same yade session ?
See e.g.
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Omega.addScene
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Omega.switchToScene
https://yade-dem.org/doc/yade.wrapper.html#scene

Revision history for this message
Janek Kozicki (cosurgi) said :
#4

"Maximum number of clients reached"

I know this error. By default the xserver-org (the program that controls the display) can support at maximum 256 xclients. This may be translated into having at maximum 256 windows open, but that's not true. For example chromium uses just one xclient connection even if it has 50 windows opened, while cssh uses 136 xclient connections even though it has only 4 windows opened. Okular is very annoying on the other end, because it uses one additional xclient connection everytime I recompile latex and refresh file inside okular. After lengthy latex editing session I suddenly can't open any more windows, even a terminal. That's why I moved to katarakt for pdf display, and use okular sparingly.

Yade behaves "normally" in that it uses one xclient connection per window opened. However running multiple yade simulations still makes you run out of xclient connections rather quickly. That's why it's more efficient to run them without $DISPLAY variable and without windows.

I did recompile xserver-org package locally to increase xclients limit to 512, just to make this nuisance less annoying.

You can check how many xclient connections are using with this command:

xlsclients | wc -l

That's the explanation for what really happens for you. However Jérôme has the best solution for your problem, I think :)

best
Janek

Revision history for this message
Jan Stránský (honzik) said :
#5

Hi Janek,
thanks for comprehensive description :-)

> That's why it's more efficient to run them without $DISPLAY variable and without windows.

just to make it clear for those who does not know the option, to run yade without DISPLAY, launch it with -n switch, i.e.
yade -n
or
yade -n script.py
see "yade --help" for more info
(yade command can differ, e.g. yade-2017.01a etc.)

cheers
Jan

Revision history for this message
dan.wang (dan.wang) said :
#6

I am Open yade from shell which is :

#!bin/bash
for k in $( seq 1 32 )
do
 filestart=yade' '${k}.py
 xterm -e "$filestart"&
done

with the command "xlsclients | wc -l" ,it returns 156, and I have ONLY opened 48 Yade windows. what I want is open another 32 Yade windows or more.
can I ask how to increase xclients limit to 512 and how to run Yade without $DISPLAY variable and without windows?

Thanks very much. YOU are so great!!

Dan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#7

>how to increase xclients limit to 512 and how to run Yade without $DISPLAY

See Jan's extra answer. Actually it is "increase to 512" _OR_ "run without $DISPLAY". Doing both is useless, and the second is definitely the best answer.

>https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Omega.switchToScene

Is not an option I guess, since you want to run parallel (no?).

> recompile xserver-org package

Simplest solution ever! ;) (very instructive answer)

B

Revision history for this message
Jan Stránský (honzik) said :
#8

> See Jan's extra answer. Actually it is "increase to 512" _OR_ "run without $DISPLAY". Doing both is useless, and the second is definitely the best answer.

Actually running yade without display would not solve the problem as xterm is also increasing the the number of clients..

Please give us more info how do you deal with the opened yade afterwards, maybe we can find a better solution

cheers
Jan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#9

>without display [...] xterm is also increasing the the number of clients

Mmmmh... I see (I think).
So I would say the real problem was to use xterm in the first place. I'm guessing the purpose of all this is to control multiple Gauss points in parallel by manipulating threads, it doesn't need an "xterm" command.
Maybe something like "screen -d -m $filestart"?

We need more info on the problem, and actually if the problem is really to manipulate threads it could be much easier to manipulate the threads with python. The DEMxFEM coupling is a good example of this.

Bruno

Revision history for this message
Janek Kozicki (cosurgi) said :
#10

Bruno Chareyre said: (by the date of Mon, 30 Oct 2017 14:03:18 -0000)

> > recompile xserver-org package
>
> Simplest solution ever! ;) (very instructive answer)

Hehe, yeah. And I was this close to posting a full recompile
instructions of xorg-server for debian :-) Like this:

  mkdir XORG-512
  cd XORG-512
  sudo apt-get build-dep xorg-server
  sudo apt install dpkg-dev
  apt-get source xorg-server
  cd xorg-server-1.19.3
# change MAXCLIENTS #define in file include/misc.h to #define MAXCLIENTS 512
  time dpkg-buildpackage -rfakeroot -b -j8

Oops, I posted this :)

BTW, while doing this I noticed that in latest xserver they upped
MAXCLIENTS to 2048, but introduced LIMITCLIENTS 256. I didn't check
what that means ;) Maybe the it's better to up LIMITCLIENTS to 512?

@dan.wang you might encounter a multitude of weird errors if you try
to do that. This is rather not a good direction to go in the case of
your problem. It only solves symptoms, not the problem. And also it
is really an overkill, like killing a fly from a cannon. So if you
insist, you only do this at your own risk :)

--
Janek Kozicki http://janek.kozicki.pl/ |

Revision history for this message
dan.wang (dan.wang) said :
#11

Hi to all of you
Thanks so much for your answers.
Let me explain the purpose:

I am doing the FEM-DEM coupling. we discretize structure in FEM, and build the DEM model at each elements' Gauss point as representative volume element. FEM will send a strain to DEM and then DEM calculate the stress and send it back to FEM.

 Each gauss point related to one Yade client.

SO in one structure, we will build lots of Yade clients to achieve the parallel calculation.

Thanks again

Dan

Revision history for this message
Jan Stránský (honzik) said :
#12

Hello,
thanks for the info, but it is too general and could have been guessed from you original description.

I meant something g like how you communicate with the yade sessions, how you manage the overall simulation, how you start yade, how you send strain and stresses etc.. If we know your approach, maybe we can find a solution which does not open new xterm for each yade session..

> #!bin/bash
> for k in $( seq 1 32 )
> do
> filestart=yade' '${k}.py
> xterm -e "$filestart"&
> done

like here, it is clear you are using a shell script. Is it possible to put your source codes somewhere to the internet, e.g. on Dropbox?

thanks
Jan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#13

That's what I suspected. Although I like to see this approach from an experimentalist point of view I must say I don't think it will work very well.
How will you pass the data/instructions between the FEM process and the xterm instances?
Yade has a FEM-DEM coupling already, which does what you describe overall but completely differently, and efficiently. I strongly suggest to check it.
Bruno

Revision history for this message
whr (huanran-wu) said :
#14

You can check this page:
https://yade-dem.org/doc/FEMxDEM.html?highlight=femxdem

The FEMxDEM part does exactly the way you described.

Huanran

Revision history for this message
dan.wang (dan.wang) said :
#15

I am using opensees in Windows system to do the FEM part. And I am curious about Guoning's method to achieve the calculation of "hundreds to thousands of RVEs".
I will give u the source code after publishing our paper.

Thanks again.