how to limit the output to screen?
how to limit the output to screen?
Is there a way to run elegant without having all the output print to the screen?
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: how to limit the output to screen?
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
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
Re: how to limit the output to screen?
helps a lot thank you!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
Re: how to limit the output to screen?
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
Is there any plan to support user to disable the output message using a flag?
Guobao
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: how to limit the output to screen?
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
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
Re: how to limit the output to screen?
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
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
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: how to limit the output to screen?
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
-
- Posts: 1959
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: how to limit the output to screen?
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
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