[petsc-dev] Use of the DISPLAY environment variable
Satish Balay
balay at mcs.anl.gov
Sun Aug 29 15:42:31 CDT 2010
On Sun, 29 Aug 2010, Barry Smith wrote:
>
> On Aug 29, 2010, at 2:45 PM, Jed Brown wrote:
>
> > PETSc uses the -display option differently from the DISPLAY environment
> > variable. In particular, it prepends the hostname when DISPLAY starts
> > with ":".
> >
> > ierr = PetscOptionsGetString(PETSC_NULL,"-display",PetscDisplay,256,&flag);CHKERRQ(ierr);
> > if (flag) PetscFunctionReturn(0);
> > [...]
> > str = getenv("DISPLAY");
> > if (!str || (str[0] == ':' && size > 1)) {
> > ierr = PetscGetHostName(display,255);CHKERRQ(ierr);
> > ierr = PetscStrcat(display,":0.0");CHKERRQ(ierr);
> > } else {
> > ierr = PetscStrncpy(display,str,256);CHKERRQ(ierr);
> > }
> >
> > Is this really the right thing (ignoring the small overflow
> > possibility)? Why not concatenate hostname with the value of DISPLAY
> > when it starts with ':'?
>
> I'm not sure why it was set to always use :0.0 there. Yes it sounds reasonable to use DISPLAY there.
> >
> > But more importantly, firewalls are frequently set up to block port
> > 6000, so DISPLAY=hostname:0.0 won't work, but DISPLAY=:0.0 will work
> > (obviously only among local nodes). I've just gotten used to always
> > running with -display :0 in parallel, but how about reducing the
> > hostname to check whether it is the same on all hosts. If so, then just
> > use DISPLAY as is. This would make graphics Just Work on more systems.
>
> This sounds fine.
>
> Barry
>
> >
> > Does this sound reasonable?
Yes - I like this change [and also remove all the extra stuff] in this
routine.
It was tailored for one type of setup that probbly doesn't exist anymore.
As you say - the more common setup [which --download-mpich
etc. default to] is to run all procs on the same node - so perhaps
the following code is sufficient.
>>>>>>
str = getenv("DISPLAY");
if (str) {
ierr = PetscStrncpy(PetscDisplay,str,256);CHKERRQ(ierr);
} else {
ierr = PetscStrncpy(PetscDisplay,":0.0",256);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
<<<<<
Satish
More information about the petsc-dev
mailing list