[petsc-dev] Use of the DISPLAY environment variable
Barry Smith
bsmith at mcs.anl.gov
Sun Aug 29 15:20:46 CDT 2010
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?
>
> Jed
More information about the petsc-dev
mailing list