![]() ![]() At the bottom of the section, the spec says : That is, it copies the scalar variables and hence the change from the omp target block is not visible after leaving the block. the answer is typically not, but there is certainly bias due to my use case.If you compare GCC's behavior with the description of the implicit data mapping rules from the OpenMP 5 specification, Section 2.19.7 "Data-Mapping Attribute Rules, Clauses, and Directives", it seems that GCC is doing the right thing here. Later in time, when everything is stabilized, I decide if the boilerplate code is actually worth the effort just for the sake of using the same name for calling the function/subroutine on different types. Then I just put the different version in a module and keep the names different and clear. I don't write code for others to be used in a library, so I might be skewed, but whenever I find myself in the need of the same subroutine for different types (and honestly, this only happened for linked lists and sort/search stuff) I first take the chance to analyze the thing for every different data type, in order to understand if I can rearrange stuff differently, reuse memory in some cases, etc. Honestly, if a library is what you want to write, and you don't want to use Fortran interfaces and stuff, there is clear indication that you have selected the wrong language in the first place, at least for now (may change in the future, who knows). I know it is used a lot, but I feel pain every time I see such solutions. Personally, I am an integralist of formalisms, and the fact that you are using some meta language to solve an issue with your selected language, well. ![]() The meta-language approach is another one. The tedious, formal one is the interface (which is a non solution, because you actually write a lot of identical code + boiler plate stuff for the interface). In the second case, of course, there is no chance to use the two previous approaches and you need a different route. Still, as I wrote, I would prefer the latter. ![]() In the first case it is possible to use both the compiler flags and the selected kinds approaches. It isn't clear if you want to be able to compile your code in both single and double precision versions or if you want to write a set of functions and/or subroutines for both. Honestly, it really depends from what you actually want to do. This is explained in this stackoverflow answer : We can #define MYTYPE and #include a template file which uses the MYTYPE macro. I found out a trick to remove repetition. Writing the interface becomes tedious due to the amount of repeated code. ![]() Switching between single and double precision in Fortran - CFD Online Discussion Forums ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |