in reply to Re^4: How to vectorize a subroutine--perhapse using PDL piddles or threads
in thread How to vectorize a subroutine--perhapse using PDL piddles or threads

Okay. You might want to remove your code, because I do not think that there is much that we can do to help you.

Beyond suggesting that you should use strict and -w, which would allow you to notice things like:

open (INPUTFILE, ">$inputfile"); ... close(INTPUTFILE);

And that you should be using lexical file handles within your subroutines. Being IO-bound code, there is not a lot that could be done to speed this up.

I assume from your explanation that most of the CPU bound stuff is going on inside the psi3, and that is outside your remit to tune. Previously, from your mention of PDL, I thought that you were doing the complex math. All that leaves is a little relatively simple, IO-bound code that will not benefit from threading or PDL.

Probably your best bet would be to look at Parallel::ForkManager and see if that fits with you aspirations. It would allow you to start your processes, whilst managing how many run concurrently. If you think that module fits the bill, and you need help on how to use it, I'd suggest posting a new question with that in the title, as I have no experience of it.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^6: How to vectorize a subroutine--perhapse using PDL piddles or threads
by Feynman (Novice) on Sep 08, 2010 at 19:49 UTC
    Thank you-I removed the code. On the contrary, you saved me weeks of research. Although there is less I can do to make my code run faster--it is great to know that so I can move on and look at other aspects! Also, that forking module seems very promising. I will absolutely look into it.
    Thanks again