how to limit the output to screen?

Moderators: cyao, soliday

Post Reply
cmcg
Posts: 2
Joined: 13 Oct 2008, 17:03

how to limit the output to screen?

Post by cmcg » 13 Oct 2008, 17:04

Is there a way to run elegant without having all the output print to the screen?

michael_borland
Posts: 1959
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how to limit the output to screen?

Post by michael_borland » 13 Oct 2008, 17:12

It can be done. Depending on which shell you use, the command is different.

For csh or tcsh, you can redirect the output into a log file using
% elegant inputfile >& logfile

For bash, you should use
% elegant inputfile 2>1 > logfile
(Please observe the spaces carefully.)

If you don't want to put the output in a file but just want to ignore it, use /dev/null instead of a filename for "logfile".

This should work fine on Linux, Unix, OS-X, and Cygwin.

--Michael

cmcg
Posts: 2
Joined: 13 Oct 2008, 17:03

Re: how to limit the output to screen?

Post by cmcg » 13 Oct 2008, 23:39

Thanks!

leocmq
Posts: 4
Joined: 16 Jan 2009, 02:53

Re: how to limit the output to screen?

Post by leocmq » 16 Jan 2009, 03:02

michael_borland wrote:It can be done. Depending on which shell you use, the command is different.

For csh or tcsh, you can redirect the output into a log file using
% elegant inputfile >& logfile

For bash, you should use
% elegant inputfile 2>1 > logfile
(Please observe the spaces carefully.)

If you don't want to put the output in a file but just want to ignore it, use /dev/null instead of a filename for "logfile".

This should work fine on Linux, Unix, OS-X, and Cygwin.

--Michael
helps a lot thank you!
Hear Me . .

shengb
Posts: 6
Joined: 11 Feb 2009, 11:06

Re: how to limit the output to screen?

Post by shengb » 11 Feb 2009, 11:19

It just redirects the output to a file or /dev/null.

Is there any plan to support user to disable the output message using a flag?

Guobao

michael_borland
Posts: 1959
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how to limit the output to screen?

Post by michael_borland » 11 Feb 2009, 13:26

Guobao,

That would be quite a job since elegant freely sends output to stdout and stderr from within subroutines.

We could probably add a flag that redirects stderr and stdout to /dev/null using freopen(), but I'm not sure if that answers your requirements.

--Michael
shengb wrote:It just redirects the output to a file or /dev/null.

Is there any plan to support user to disable the output message using a flag?

Guobao

shengb
Posts: 6
Joined: 11 Feb 2009, 11:06

Re: how to limit the output to screen?

Post by shengb » 11 Feb 2009, 14:44

Hi Michael,
The output to stdout and stderr provides many useful information and very helpful
when using the elegant as a standalone executable application.

It will cause some trouble if we make the elegant as a simulation server and run 24/7,
or even crash the server. I do have some experience on that and hope there is a plan
to have a selection to enable/disable the output.

Another solution might be add a flag such as
#ifdef LIBRARY
set_print_namelist_flags(1);
#else
set_print_namelist_flags(0);
print_namelist(...);
#endif

Then we can select the flag to enable/disable the output when we compile it.
But just as you mentioned, it would be a big job because the output distributes everywhere
in whole SDDS/Elegant code.

I am not sure which one is better.

Guobao

michael_borland
Posts: 1959
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how to limit the output to screen?

Post by michael_borland » 11 Feb 2009, 15:54

shengb wrote:Hi Michael,
The output to stdout and stderr provides many useful information and very helpful
when using the elegant as a standalone executable application.

It will cause some trouble if we make the elegant as a simulation server and run 24/7,
or even crash the server. I do have some experience on that and hope there is a plan
to have a selection to enable/disable the output.

Another solution might be add a flag such as
#ifdef LIBRARY
set_print_namelist_flags(1);
#else
set_print_namelist_flags(0);
print_namelist(...);
#endif

Then we can select the flag to enable/disable the output when we compile it.
But just as you mentioned, it would be a big job because the output distributes everywhere
in whole SDDS/Elegant code.

I am not sure which one is better.

Guobao

michael_borland
Posts: 1959
Joined: 19 May 2008, 09:33
Location: Argonne National Laboratory
Contact:

Re: how to limit the output to screen?

Post by michael_borland » 11 Feb 2009, 16:02

Guobao,

I think my last message didn't post because of a large attachment.

It turned out to be very easy to add flags to divert output to a user-specified file (or /dev/null).

I'll send you something about it via private email so you can get the new source.

--Michael
shengb wrote:Hi Michael,
The output to stdout and stderr provides many useful information and very helpful
when using the elegant as a standalone executable application.

It will cause some trouble if we make the elegant as a simulation server and run 24/7,
or even crash the server. I do have some experience on that and hope there is a plan
to have a selection to enable/disable the output.

Another solution might be add a flag such as
#ifdef LIBRARY
set_print_namelist_flags(1);
#else
set_print_namelist_flags(0);
print_namelist(...);
#endif

Then we can select the flag to enable/disable the output when we compile it.
But just as you mentioned, it would be a big job because the output distributes everywhere
in whole SDDS/Elegant code.

I am not sure which one is better.

Guobao

Post Reply