geotopmodel / geotop

GEOtop is a distributed model of the mass and energy balance of the hydrological cycle, which is applicable to simulations in continuum in small catchments. GEOtop deals with the effects of topography on the interaction between energy balance and hydrological cycle with peculiar solutions.
GNU General Public License v3.0
38 stars 29 forks source link

Vectorization #104

Closed ElisaBortoli closed 5 years ago

ElisaBortoli commented 5 years ago

[WIP]

Added the possibility to compile with -march=native, flag activated putting -DWITH_VECTORIZATION=true.

Now this flag is available if compiling with Meson but soon it will be available also for CMake

asartori86 commented 5 years ago

@ElisaBortoli, I don't like this PR. -march=native means compile with the features that the cpu where I am compiling support. If your cpu does not have AVX, then you will not vectorize. Moreover, this is just a compile flags, not a link one. I think that if you want to enable avx or whatever, the right way is through -Dcpp_args='-march=native' The approach you are proposing is flawed if you want to compile on a machine and then run on a different one. For example, inside a login node but then you run on a computing node and the two can be different. In this scenario, if you want to enable all the features of the computing node you cannot use -march=native but the architecture of the computing node e.g. -march=knl or -march=ivybridge.

ElisaBortoli commented 5 years ago

Ok, -march=native is not correct becase the compiling node could be different from the computing node but I'd like to introduce the possibility of exploit such features. So for the thesis I could use one of this flag, depending on the architecture I'm using, and for the geotop users we could just mention it in the readme....?

Anyway I saw that we can also activate a part of the vectorization flag (i.e., -mavx ?) https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/i386-and-x86-64-Options.html so this could be more general..

Concluding, this could be a branch where I (or someone else) could start thinking about vectorization, this was my idea.

asartori86 commented 5 years ago

Elisa, as I said, there is no need to define a build option here. Just compile with the -Dcpp_args='-march=ivibridge'

asartori86 commented 5 years ago

to be clear: I want to close this PR. I just waited if someone else wants to say something

ElisaBortoli commented 5 years ago

I left the flag because for me it's faster to use an already defined compiled flag for the thesis. But If you want to close the PR, ok, let's do it.