gs2.fpp vs gs2_main.fpp
gs2.fpp
looks like the following:
program gs2
! make_lib is a compiler flag used if running with
! an old version of trinity (coupled flux tube code)
! MAKE_LIB is now deprecated.
# ifndef MAKE_LIB
! code
# else
implicit none
call run_gs2
# endif
end program gs2
where ! code
is pretty similar to the body of run_gs2
but with some differences.
Currently, nothing sets MAKE_LIB
so we end up with the version in gs2.fpp
– should we in fact just be using run_gs2
?
Comments (7)
-
-
reporter Nope, a lot of errors. If we remove
MAKE_LIB
fromgs2_main.fpp
so that it always uses a module then it does compile. The tests pass, although I’m not sure how many actually run thegs2
program.I guess you might not want a module if you were calling the functions from C, but there are better ways to make that easier and still use a module.
-
Did you try
make gs2
ormake libgs2.a
? I think whenMAKE_LIB
is defined only the later is supported. -
reporter Just
make
which madebin/gs2
andlib/libgs2.a
. -
I was just wondering if all the errors came from gs2, or if it came from both or just the lib. Or was it just at the compilation stage?
-
reporter Ah sorry, they were all compilation errors from gs2_main.fpp, mostly like
Error: Derived type ‘gs2_program_state_type’ at (1) is being used before it is defined
, andSymbol ‘state’ at (1) has no IMPLICIT type
. All solved by just removing the#ifdef
s from around themodule
parts:--- a/src/gs2_main.fpp +++ b/src/gs2_main.fpp @@ -11,8 +11,6 @@ module old_interface_store logical :: override_miller_geometry = .false. end module old_interface_store -# ifndef MAKE_LIB - !> This module provides the external interface to gs2. It contains functions !! to initialize gs2, functions to run gs2, functions to finalize gs2 and !! functions to override/tweak gs2 parameters. @@ -302,7 +300,6 @@ module gs2_main type(gs2_program_state_type) :: old_iface_state contains -# endif !> Starts the global wall clock timer !! used by check time. This is useful @@ -1947,8 +1944,4 @@ contains end subroutine gs2_trin_init -# ifndef MAKE_LIB end module gs2_main -# endif
-
Ah ok, that makes sense. I think that shows that this MAKE_LIB approach isn’t really supported anymore – I think we’d need to cut out a whole bunch of other stuff that has been introduced to gs2_main.fpp to retain the old MAKE_LIB approach.
- Log in to comment
The comments say
MAKE_LIB
is deprecated and just for old versions of trinity so I think we probably can drop it. If we defineMAKE_LIB
thengs2_main.fpp
ends up being a bunch of routines outside of a module (so I guess the old trinity just calls these directly without using them). It might be interesting to see if we can even compile withMAKE_LIB
defined.