Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

problem in running code

roddur
Beginner
760 Views
i am running a code where i am getting a strange problem i.e. program is getting stuck after a few loop. i am putting the log file!
$ ./irun
Concentration of Atom A = 0.600000000000000
Concentration of Atom B = 0.400000000000000
Running ASR loop 1
Reading ASMAP Complete
WORKING FOR SPIN UP
Reading POTENTIAL PARAMETERS from POTPAR_A
Reading POTENTIAL PARAMETERS from POTPAR_B
WORKING FOR ATOM 1
Reading STRUCTURE MATRIX complete
Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 1 Starting orbital loop 3............................done
done
done
done
WORKING FOR ATOM 2
Reading STRUCTURE MATRIX complete
Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 1 Starting orbital loop 3..........................done
done
..done
done
WORKING FOR SPIN DW
Reading POTENTIAL PARAMETERS from POTPAR_A
Reading POTENTIAL PARAMETERS from POTPAR_B
WORKING FOR ATOM 1
Reading STRUCTURE MATRIX complete
Starting orbital loop 3 Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 1..........................done
done
..done
done
WORKING FOR ATOM 2
Reading STRUCTURE MATRIX complete
Starting orbital loop 7 Starting orbital loop 3 Starting orbital loop 1 Starting orbital loop 5............................done
done
done
done

Running ASR loop 2
Reading ASMAP Complete
WORKING FOR SPIN UP
Reading POTENTIAL PARAMETERS from POTPAR_A
Reading POTENTIAL PARAMETERS from POTPAR_B
WORKING FOR ATOM 1
Reading STRUCTURE MATRIX complete
Starting orbital loop 3 Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 1..........................done
..done
done
done
WORKING FOR ATOM 2
Reading STRUCTURE MATRIX complete
Starting orbital loop 1 Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 3..........................done
..done
done
done
WORKING FOR SPIN DW
Reading POTENTIAL PARAMETERS from POTPAR_A
Reading POTENTIAL PARAMETERS from POTPAR_B
WORKING FOR ATOM 1
Reading STRUCTURE MATRIX complete
Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 3 Starting orbital loop 1............................done
done
done
done
WORKING FOR ATOM 2
Reading STRUCTURE MATRIX complete
Starting orbital loop 3 Starting orbital loop 7 Starting orbital loop 5 Starting orbital loop 1............................

Since the result is from a do loop, i dont feel there is any apperent reason why program should stuck. Can you people suggest some reason/ compilation option so that i can check the memory use etc?
that will be a great help for me
0 Kudos
5 Replies
rreis
New Contributor I
760 Views
for checking memory you can always use top, htop or ps...

can you edit the source? maybe you could monitor the variables (especially the ones that should get you out of the loop). another chance is to run the code in a debugger, for instance ddd can use the intel debugger. do you have access to the code source? is this a mac or a linux machine?

best regards,
0 Kudos
roddur
Beginner
760 Views
yes....its written by me (hence i have the source)....the problem is its not showing any error
0 Kudos
rreis
New Contributor I
760 Views
Quoting - roddur
yes....its written by me (hence i have the source)....the problem is its not showing any error

another thing you can do is to run it under valgrind to check for memory leaks or something of the kind. when you say "stuck" you mean the program freezes?
0 Kudos
roddur
Beginner
760 Views
Quoting - rreis

another thing you can do is to run it under valgrind to check for memory leaks or something of the kind. when you say "stuck" you mean the program freezes?
exactly! no error, no crash...just freezes....but tven then if i do top, its taking 100%cpu per thread, i.e. if i run with 4 thread, it shows cpu uses ~390-395.
0 Kudos
jimdempseyatthecove
Honored Contributor III
760 Views

roddur,

Most debuggers have a "Break into program now" button. On Windows Visual Studio Debugger the button looks like a pause button ||
The debugger you use on Linux/Mac will likely have a similar button. Once you break into the program you can context switch between threads and see where each is sitting.

What you are describing is called a deadlock. A waiting for B, B waiting for C, C waiting for A. Or even something as obvious as A waiting for A (obvious once you see the fault in your code).

Another thing you can do is run a profiler. Run it into the deadlock condition and let it burn for 10-20 seconds and then stop. The profiler will show you where the high activity was taking place.

Jim Dempsey
0 Kudos
Reply