Andy - I can appreciate your terror at tweaking legacy code.

On Wed, 20 Jun 2018, Brad Chamberlain wrote:

In rewriting to Chapel, could you just defer the declarations of the arrays until the point in the Fortran code where the dynamic allocations take place? While I understand the desire for a 1:1 translation, for a pattern that's (in my opinion) as ugly as this in Fortran, you'd just be unnecessarily propagating that ugliness into the future if you keep it split between two lines like this...

I have found that the key point is thst you need avoid the 1:1 translation rule as this ties your hands.

(and I'm guessing that nothing much is done with the array until it is allocated, which would suggest that making the second location the declaration point in Chapel shouldn't break anything?)

Too much of my knowledge is dated so take this with a grain of salt ....

I prefer to simplify the Fortran 90 first and introduce break points into the cleaner Fortran code that allows you to compare data, item by item, at these break points within the older rubbish and the newer cleaner code. So make sure your cleaner Fortran version works before you start refactoring into Chapel. Your Chapel code should include the same breakpoints. Do not go overboard in your Fortran cleanup!

Where the ALLOCATE statements preceed other code in the same routine, the refactoring becomes messy. After ALLOCATE statements, I prefer to simply
immediately call a subsidiary routine to do the work. That makes things a
lot easier to convert. Is this possible?

Have you hit the Fortran code with something like Eclipse with Photran or Cleanscape, or even K-scope/K-graph or fortesg/fortrancallgraph. Run such a tool to see what pops out to help. There is also Intel Parallel Studio XE which has some static analysis tools but I have never used it.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to