Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fails for repeated kernel with different arguments #109

Open
spjammy opened this issue Sep 19, 2017 · 4 comments
Open

Compilation fails for repeated kernel with different arguments #109

spjammy opened this issue Sep 19, 2017 · 4 comments

Comments

@spjammy
Copy link

spjammy commented Sep 19, 2017

Hi,

The Compilation fails for repeated kernel with different arguments. Sequentail version works but not genseq or other translated versions. The error is repeated par_loop kernels.

op_par_loop(test, "test1", faces,
op_arg_dat( a, -1, OP_ID, 1, OP_READ),
op_arg_dat( c 0, some_mapping , 1, OP_READ),
op_arg_dat( c, 1 some_mapping , 1, OP_READ));

op_par_loop(test, "test1", faces,
op_arg_dat( d, -1, OP_ID, 1, OP_READ),
op_arg_dat( e, 0, some_mapping , 1, OP_READ),
op_arg_dat( e, 1 some_mapping , 1, OP_READ));

Is it easy to handle such in the translator?

@spjammy spjammy changed the title Translator fails for repeated kernel with different arguments Compilation fails for repeated kernel with different arguments Sep 19, 2017
@reguly
Copy link
Collaborator

reguly commented Sep 20, 2017

The kernel specs you wrote down are missing arguments and commas.
op_par_loop(test, "test1", faces,
op_arg_dat( a, -1,OP_ID, 1, "double",OP_READ),
op_arg_dat( c, 0, some_mapping , 1, "double",OP_READ),
op_arg_dat( c, 1, some_mapping , 1, "double",OP_READ));

op_par_loop(test, "test1", faces,
op_arg_dat( d, -1,OP_ID, 1, "double",OP_READ),
op_arg_dat( e, 0, some_mapping , 1, "double",OP_READ),
op_arg_dat( e, 1, some_mapping , 1, "double",OP_READ));

This does work for me with the master branch. Please confirm and close the issue if it works.

@spjammy
Copy link
Author

spjammy commented Sep 20, 2017

Sorry I missed the arguments double while creating the representative case.

here is the actual code
// Checking internal faces
op_par_loop(check_normals, "normals", faces,
op_arg_dat(p_face_normal, -1, OP_ID, 2, "double", OP_RW),
op_arg_dat(p_cell_centroid, 1, opface_cell_map, 2, "double", OP_READ),
op_arg_dat(p_face_centre, -1, OP_ID, 2, "double", OP_READ));
//-------CHECKING BOUNDARY FACE NORMAL-----//
op_par_loop(check_normals, "normals_b", bfaces,
op_arg_dat(p_face_normal_b, -1, OP_ID, 2, "double", OP_RW),
op_arg_dat(p_cell_centroid, 0, opboundary_cell_map, 2, "double", OP_READ),
op_arg_dat(p_face_centre_b, -1, OP_ID, 2, "double", OP_READ) );
It translates well. But fails in compilation

make solver_genseq

check_normals.h: In function ‘void check_normals(double*, const double*, const double*)’:
check_normals.h:1:13: error: redefinition of ‘void check_normals(double*, const double*, const double*)’
inline void check_normals(double face_normals, const double cell_centroid, const double face_centre)
^
In file included from check_normals_seqkernel.cpp:6:0,
from cfdsolver_seqkernels.cpp:22:
check_normals.h:1:13: note: ‘void check_normals(double
, const double
, const double
)’ previously defined here
inline void check_normals(double *face_normals, const double cell_centroid, const double face_centre)
^
In file included from cfdsolver_seqkernels.cpp:23:0:
check_normals_seqkernel.cpp: In function ‘void op_par_loop_check_normals(const char
, op_set, op_arg, op_arg, op_arg)’:
check_normals_seqkernel.cpp:9:6: error: redefinition of ‘void op_par_loop_check_normals(const char
, op_set, op_arg, op_arg, op_arg)’
void op_par_loop_check_normals(char const *name, op_set set

@reguly
Copy link
Collaborator

reguly commented Sep 21, 2017 via email

@spjammy
Copy link
Author

spjammy commented Sep 21, 2017

Yes, I did the workaround currently by copying check_normals for the boundary loop to check_normals_b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants