Turn off writing to screen in Fortran 90

In summary, the conversation discusses the possibility of using a compiler command to suppress write(*,*) statements in order to save time during production runs of a code. The option of redirecting standard output to /dev/null on Unix-based systems is mentioned, but the question of how to do so on a Windows system is also raised.
  • #1
MichielM
23
0
Hi,
Is there a command available that makes the compiler ignore all write(*,*) statements?!
The thing is, I'm working on a code which will eventually run for several hours (perhaps days) to complete a single run. At the moment I'm testing so I write a lot of data to the screen in order to 'follow the program', but once I start do production runs the screen writing will probably take valuable time so then I want to turn it off.

Of course I can write if..then statements around each write(*,*) such that I can use a variable to switch writing on or off, but I was wondering if there might be a compiler command to suppress write(*,*) statements?!

Thanks in advance
 
Technology news on Phys.org
  • #2
If you're using a Unix-based system, you can redirect standard output to /dev/null:

% myprogram > /dev/null
 
  • #3
nice, thanks!

And if I use a windows system? (I have linux at home, but my university uses windows)
 

What is the purpose of turning off writing to screen in Fortran 90?

The purpose of turning off writing to screen in Fortran 90 is to improve the efficiency of the program by reducing the amount of time spent on displaying output on the screen. This is especially useful for large, complex programs where frequent screen output can slow down the execution.

How do I turn off writing to screen in Fortran 90?

To turn off writing to screen in Fortran 90, you can use the IMPLICIT NONE statement at the beginning of your program. This will prevent any variables from being automatically printed to the screen. You can also use the WRITE statement with the UNIT= specifier to write output to a specific file instead of the screen.

Can I still debug my program if I turn off writing to screen in Fortran 90?

Yes, you can still debug your program even if you turn off writing to screen in Fortran 90. You can use the WRITE statement with the UNIT= specifier to print specific variables or values to a file for debugging purposes.

Will turning off writing to screen affect my program's output?

Yes, turning off writing to screen in Fortran 90 will affect your program's output. Any variables or values that were previously automatically printed to the screen will no longer be displayed. However, you can still use the WRITE statement with the UNIT= specifier to print specific output to a file.

Are there any drawbacks to turning off writing to screen in Fortran 90?

The main drawback of turning off writing to screen in Fortran 90 is that it can make debugging more difficult, as you won't see the values of variables printed to the screen automatically. However, this can be mitigated by using the WRITE statement with the UNIT= specifier to print specific output to a file for debugging purposes.

Similar threads

  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
2
Replies
37
Views
3K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
2
Views
945
  • Programming and Computer Science
Replies
11
Views
9K
  • Programming and Computer Science
2
Replies
59
Views
5K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
8
Views
3K
Back
Top