Recoding an VERY old piece of software (originally vector for a CRAY XMP) to run faster on my PC. The following code is typical of some limiting sequences:
DO j = 1, nelem
W(j) = zero
DO i = 1, nfmaxp2
IF ( CN(i,j)>0 ) W(j) = W(j) + A(i,j)*u(CN(i,j))
Problem is the IF statement and I've tried server variations to speed things up but no real progress. Thought the brain truss here might have some suggestions.
Note: The original code on a particular test case ran 35+hrs on the CRAY. Today on my Haswell CPU PC running 8 threads and using the latest Intel Fortran compiler it takes 6+ minutes but there is still room for improvement.