Fortran-FOSS-Programmers / FOODIE

Fortran Object-Oriented Differential-equations Integration Environment, FOODIE
126 stars 30 forks source link

Unnecessary Finalization #34

Closed cmacmackin closed 8 years ago

cmacmackin commented 8 years ago

I notice that all of the finalization subroutines in the integrator types are unnecessary. They just set constants to zero or deallocate allocatables. While having an unnecessary finalization subroutine isn't a bit problem in and of itself, the version of gfortran (4.8.4) on the Ubuntu computer in my office does't support finalization and therefore won't compile. Ideally I would just install gfortran5 from the PPA, but the university doesn't trust us mere scientists with administrative rights.

In any case, I've commented out the finalization bindings as a workaround, but given that they aren't necessary and impede compiler support, I would suggest that they shouldn't be present at all. At the very least it would be good if you could add some preprocessor flags around them.

rouson commented 8 years ago

I agree with the idea of removing them. One of the great things about modern Fortran is that type finalization is rarely needed. Let's let the language shine. :)

Also, an extra procedure invocation is extra compute cycles. And I haven't looked at the code, but in the instance that the deal location fails, it's an additional place for the code to fail.

On a related note, if you'd like to build a newer version of GCC from source in your own user space without admin privileges, the OpenCoarrays installer will do it for you automatically and you'll then be able to write parallel coarray code as a bonus.

Sent from my iPhone

On Apr 15, 2016, at 7:15 AM, Chris MacMackin notifications@github.com wrote:

I notice that all of the finalization subroutines in the integrator types are unnecessary. They just set constants to zero or deallocate allocatables. While having an unnecessary finalization subroutine isn't a bit problem in and of itself, the version of gfortran (4.8.4) on the Ubuntu computer in my office does't support finalization and therefore won't compile. Ideally I would just install gfortran5 from the PPA, but the university doesn't trust us mere scientists with administrative rights.

In any case, I've commented out the finalization bindings as a workaround, but given that they aren't necessary and impede compiler support, I would suggest that they shouldn't be present at all. At the very least it would be good if you could add some preprocessor flags around them.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

szaghi commented 8 years ago

@cmacmackin

Hi Chris,

thank you very much for the advice, I was not conscious that that GNU gfortran 4.8.x does not support finalization.

The automatic implementation of finalizing TBP is one of the my bad addictions... I am always nervous when I deal with dynamic memory: I know that the compiler automatically deallocate allocatable members of a derived-type argument having intent(out) attribute... but my OCD often imposes me to be explicit! So, I often add (unnecessary) finalizing TBP when a class has allocatable members (on the contrary I think this is necessary for pointer members to avoid memory leaks). Essentially, I do not completely believe to the compilers.

I am sorry, I will work on myself to trim out my bad addictions.

As soon as possible I will remove those TBP finalization (I am very very busy now: a new open call for a stable position has been open in my Institute...)

szaghi commented 8 years ago

@rouson

Yes, I totally agree. It was a thing that I am conscious, but my bad addictions are hard to remove... sorry.

szaghi commented 8 years ago

Dear all,

this should be fixed into the just uploaded v0.2.0.

Thank you all!