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

POSIX tutorial

dondilworth
New Contributor II
4,173 Views

Today I'm looking into the POSIX routines, hoping to get multi-processor efficiency.  I have the standard documentation for all the library and function calls, but for a beginner I still have a zillion questions.  Can anyone point me to a good tutorial on the subject?  I'd hate to pester experts with dumb (to them) questions.

DD

0 Kudos
26 Replies
dondilworth
New Contributor II
979 Views

Super!  It works perfectly, thank you.

0 Kudos
andrew_4619
Honored Contributor III
979 Views

If the polling loop is causing a lot of cpu activity, put a very short sleepqq of a handfulll of milliseconds in the loop. that usually makes a big differance.

0 Kudos
dondilworth
New Contributor II
979 Views

Ooops... Not perfect.  The path that comes back from GET_COMMAND is

"C:\SYNOPSYSV14\.\Debug\SYNOPSYS200v14.exe"

What the spawnl() needs is

"C:/SYNOPSYSV14/Debug/SYNOPSYS200v14.exe"

So the spawnl() doesn't work.  Is there an easy way to convert that format?  Or should I process the line character by character myself?

0 Kudos
andrew_4619
Honored Contributor III
979 Views

That is only because you are invoking from VS with debug, it is the command line being used! If you run from the system you will get a 'normal' path. That is still a valid path I think anyway, the .\ does not add anything but will still work.

0 Kudos
dondilworth
New Contributor II
979 Views

There is more that that wrong.  The slashes are backwards and the path string has extra quote marks in it.  If I delete the quotes and change the backslashes to slashes, the spawn works ... but then the command string I pass is not read correctly when the new processes start up.

Is there a C++ call that will recover the path in a friendly fashion?  (I know this is a Fortran forum, but I'll try anything.)

0 Kudos
andrew_4619
Honored Contributor III
979 Views

why use spawnlp in fortran, you could use the built in in runqq or systemqq functions for example.

Are you running from debug? The path you are getting I am sure will be what was supplied to the system to invoke the program.

0 Kudos
Reply