- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a query about error stop.
As I understand it, it can be called anywhere in the Fortran code and will immediately close all threads and stop.
Is this correct or is there more to it than this? I ask because this is not the behaviour I am seeing.
Link Copied
16 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you be more specific? Do you mean Fortran 2008 ERROR STOP, presumably in an environment where you expect co-array images to be implemented as threads? If this is what you mean, it wouldn't surprise me if improvements in quality of implementation might be desired.
I don't think there's any specification of what ERROR STOP should do under OpenMP, which is what comes to mind first when you talk about threading.
No Fortran compiler claims to be a full implementation of Fortran 2008. Filing feature requests might help prioritize introduction of F2008 facilities.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apologies - that really was a rather vague posting from me. I am using coarrays in Fortran using the latest version of the Intel XE Composer. Calling error stop almost always does not kill all the threads which is quite frustrating.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which exact compiler version are you using? I'm not aware of a current problem with ERROR STOP. Can you show a simple example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using the latest compiler. When I construct a simple example to demonstrate the problem, it works fine!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm back with problems with 'error stop' in Fortran using the latest compiler.
The following code doesn't behave as I expect:
if (this_image() == 1) then
.
.
error stop ' Error stop called'
.
.
endif
Gives the output line 'Error stop called' on the Commad Prompt window, but kills no threads not even thread 1. Is there a workaround? All I want to do is stop all the threads and quit.
A simple example doesn't do this.
Has anyone else found this problem? It's hard to reproduce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - I can reproduce this and will pass it on to the developers. Issue ID is DPD200239636.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. Is there a work-around using OPenMP or something else that you know of?
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to completely rewrite the program to use OpenMP, you can, but that seems somewhat drastic. does your program call ERROR STOP in its normal course of operation?
I've tried some alternatives and can't get them to do anything. Very strange. If I learn of a workaround I will let you know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program I am working on is a commercial product (PolySNAP) which is used for data processing and classification. Because it's a commercial product, lots of testing and checking of both user choices and the correct functioning of the software are made. Problems and errors are flgged and the program stops if the errors are severe, so I need 'error stop' in a lot of places in the program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>Is there a work-around using
Create an coarray error status
integer :: ErrorStatus
! near top
ErrorStatus[this_image()] = 0
...
Then any image on error can set ErrorStatus .AND. ErrorStatus[1]
In appropriate places you can test ErrorStatus[1], if not 0, exit loop (appropriately), exit subroutine/function (appropriately)
Then in main level, should you (each thread) notice ErrorStatus[1] not 0, then it can issue STOP
You can conditionalize this code such that when the "exit stop 'msg'" is fixed, that you can easily change the conditional compile variable to use exit stop (leave alternate code in until you are certain exit stop is fixed +additional compiler version).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It turns out that this bug was already fixed in our code, but the fix was not put into the 13.0 stream because it was considered too risky. I will ask the developers to reconsider.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This would be invaluable; without an easy way of stopping all threads and quitting, I have serious problems in delivering my code on time as per contract! What would be the timescale?
Jim Dempseys's work-round; can this be put into a simple subroutine that will emulate error stop? I need to think about it. (Most of the time I have just one image running; it's only in a very compute intensive portion of the code that I switch to multiple images, and this part does not need error stop.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tested the following and it works. Just call this instead of using ERROR STOP.
[fortran]
subroutine my_error_stop
use kernel32
use, intrinsic :: iso_c_binding
INTEGER MPI_COMM_WORLD
PARAMETER (MPI_COMM_WORLD=1140850688)
abstract interface
subroutine mpi_abort_int (comm, status) bind(C)
integer, value :: comm, status
end subroutine mpi_abort_int
end interface
procedure(mpi_abort_int), pointer :: mpi_abort
call c_f_procpointer( &
transfer( &
GetProcAddress( &
GetModuleHandle("impimt"//C_NULL_CHAR), &
"MPI_Abort"//C_NULL_CHAR &
), &
C_NULL_FUNPTR &
), &
mpi_abort)
if (.not. associated(mpi_abort)) error stop ("Can't find MPI_Abort - must CTRLC program")
call mpi_abort (MPI_COMM_WORLD, 0)
end subroutine my_error_stop
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works! I'm very grateful for this, thanks.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to hear it! For reference, the original issue ID is DPD200233617. This will be the ID mentioned in bug fix lists.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page