CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

cfx5post in batch mode on "graphics-less" Linux

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By mjgraf

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 8, 2011, 18:48
Default cfx5post in batch mode on "graphics-less" Linux
  #1
New Member
 
Frank D.
Join Date: Jun 2009
Location: Oregon
Posts: 5
Rep Power: 17
frankyd is on a distinguished road
I am getting the following error "cannot connect to X server" while running "cfx5post -batch xxx.cse" from command line. The OS is RHEL 4 and has no graphics card, and thereby the DISPLAY environment variable is not set. I have also tried "cfx5post -batch xxx.cse -graphics mesa" without success.

Does cfx5post need a graphics display while running in batch mode???


Frank D.
frankyd is offline   Reply With Quote

Old   April 10, 2011, 22:16
Default
  #2
Senior Member
 
Join Date: Dec 2009
Posts: 131
Rep Power: 20
mjgraf is on a distinguished road
unfortunately yes.
the way we got around this to run all our macros in batch mode was to create a virtual frame buffer.

Install xvfb
http://en.wikipedia.org/wiki/Xvfb
configure (even suggest to create an init.d script so it starts all the time).
Ensure you set a reasonable resolution and color depth.

then use the -display # switch for cfxpost.

If I recall, it stems from Qt and some quick of its system.
joey2007 likes this.
mjgraf is offline   Reply With Quote

Old   April 12, 2011, 12:26
Default
  #3
Senior Member
 
Join Date: Dec 2009
Posts: 131
Rep Power: 20
mjgraf is on a distinguished road
Found my documentation
Detailed for Suse, but should be similar for RH.
Enjoy

Description
Xvfb is a virtual frame buffer to create an X display.

Installation

  1. Install Xvfb as part of YAST package: xorg-x11-server-extra
  2. Create the X auth file: /etc/Xvfb.auth
  3. Create the boot script: /etc/init.d/xvfb
  4. Make the new script executable: chmod +x /etc/init.d/xvfb
  5. Create symlink: ln -s /etc/init.d/xvfb /usr/sbin/rcxvfb
  6. Enable the init script: insserv /etc/init.d/xvfb
  7. Start the service: rcxvfb start
Notes

  • The X Auth file should only contain 'localhost'
  • One can dryrun insserv: insserv -n -v /etc/init.d/xvfb
  • insserv ensures that the new init scripts loads correctly
  • Check the init script for more info

Boot script

Xvfb script

Xvfb Settings
Display Number: 71
X Auth File: /etc/Xvfb.auth
Screen Setting: screen 0 2048x2048x24
Memory Mapped File: /tmp/Xvfb_screen0
Log File: /var/log/Xvfb_X71.log
Lock File: /tmp/.X71-lock

Code:
#!/bin/sh
#
#
# /etc/init.d/xvfb
#   and its symbolic link
# /usr/sbin/rcxvfb
#
### BEGIN INIT INFO
# Provides:          Xvfb
# Required-Start:    network nfs
# Should-Start:
# Required-Stop:     network
# Should-Stop:
# Default-Start:     3 5
# Default-Stop:
# Short-Description: Xvfb daemon, provides virtual frame buffer
# Description:       Start Xvfb
#    Primarily used for batch processing because
#    CFX and Ansys require an X Display.
### END INIT INFO
#

# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
XVFB_BIN=/usr/bin/Xvfb
test -x $XVFB_BIN || { echo "$XVFB_BIN not installed";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 5; fi; }

# Decided not to source a config file
# Left the code just incase
# Check for existence of needed config file and read it
#XVFB_CONFIG=/etc/sysconfig/xvfb
#test -r $XVFB_CONFIG || { echo "$XVFB_CONFIG not existing";
#    if [ "$1" = "stop" ]; then exit 0;
#    else exit 6; fi; }
#
# Read config
#. $XVFB_CONFIG

# The auth file is a plain text file with only "localhost" listed.
XVFB_DISPLAY=71
XVFB_AUTHFILE="/etc/Xvfb.auth"
test -r $XVFB_AUTHFILE || { echo "$XVFB_AUTHFILE not existing";
    if [ "$1" = "stop" ]; then exit 0;
    else exit 7; fi; }
XVFB_SCREEN="-screen 0 2048x2048x24"
XVFB_MMAP="/tmp"
XVFB_LOG="/var/log/Xvfb_X$XVFB_DISPLAY.log"
XVFB_ARGS=":$XVFB_DISPLAY -auth $XVFB_AUTHFILE $XVFB_SCREEN -fbdir $XVFB_MMAP"


# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     be verbose in local rc status and clear it afterwards
#      rc_status -v -r  ditto and clear both the local and overall rc status
#      rc_status -s     display "skipped" and exit with status 3
#      rc_status -u     display "unused" and exit with status 3
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num>
#      rc_reset         clear both the local and overall rc status
#      rc_exit          exit appropriate to overall rc status
#      rc_active        checks whether a service is activated by symlinks
. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
    start)
    echo -n "Starting Xvfb on DISPLAY=:$XVFB_DISPLAY"
    # Remove the old log file
    rm -f $XVFB_LOG
    ## Start daemon with startproc(8). If this fails
    ## the return value is set appropriately by startproc.
    /sbin/startproc -l $XVFB_LOG $XVFB_BIN $XVFB_ARGS

    # Remember status and be verbose
    rc_status -v
    ;;
    stop)
    echo -n "Shutting down Xvfb "
    ## Stop daemon with killproc(8) and if this fails
    ## killproc sets the return value according to LSB.

    /sbin/killproc -TERM $XVFB_BIN

    # Remember status and be verbose
    rc_status -v
    ;;
    restart)
    ## Stop the service and regardless of whether it was
    ## running or not, start it again.
    $0 stop
    $0 start

    # Remember status and be quiet
    rc_status
    ;;
    status)
    echo -n "Checking for service Xvfb "
    ## Check status with checkproc(8), if process is running
    ## checkproc will return with exit status 0.

    # Return value is slightly different for the status command:
    # 0 - service up and running
    # 1 - service dead, but /var/run/  pid  file exists
    # 2 - service dead, but /var/lock/ lock file exists
    # 3 - service not running (unused)
    # 4 - service status unknown :-(
    # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)

    # NOTE: checkproc returns LSB compliant status values.
    /sbin/checkproc $XVFB_BIN
    # NOTE: rc_status knows that we called this init script with
    # "status" option and adapts its messages accordingly.
    rc_status -v
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
esac
rc_exit
mjgraf is offline   Reply With Quote

Old   April 12, 2011, 17:47
Default
  #4
New Member
 
Frank D.
Join Date: Jun 2009
Location: Oregon
Posts: 5
Rep Power: 17
frankyd is on a distinguished road
Thanks mjgraf!

Using xvfb-run (wrapper around xvfb) solved the problem.

Frank D.
frankyd is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Ansys in BAtch Mode kuleuvenstudent ANSYS 1 October 18, 2017 13:11
fluent 12.1, batch mode in linux sakalido FLUENT 13 September 27, 2017 09:55
making animation in batch mode in linux rocklove FLUENT 0 July 10, 2010 03:17
CFX5Post error in batch mode with Perl windhair CFX 2 March 20, 2007 06:41
Prosurf in batch mode Dhruv Siemens 1 September 19, 2005 19:02


All times are GMT -4. The time now is 16:24.