Skip to content

Commit 950692d

Browse files
committed
update code generation to properly print the used mode (interface of preload)
1 parent 79054fc commit 950692d

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

src/resources/generator_data/code/C/templates/template_A.jinja

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,16 @@
8787
int wi4mpi_rank;
8888
R_MPI_Comm_rank(R_MPI_COMM_WORLD, &wi4mpi_rank);
8989
if (wi4mpi_rank == 0)
90+
#if defined(_MPC) || defined(_OMPI) || defined(_INTEL)
91+
fprintf(
92+
stdout, "You are using Wi4MPI-%s in the interface mode to %s\n",
93+
getenv("WI4MPI_VERSION"), getenv("WI4MPI_TO"));
94+
#else
9095
fprintf(
9196
stdout, "You are using Wi4MPI-%s in the preload mode from %s to %s\n",
9297
getenv("WI4MPI_VERSION"), getenv("WI4MPI_FROM"), getenv("WI4MPI_TO"));
93-
{%- endif -%}
98+
#endif
99+
{% endif %}
94100
in_w=0;
95101
{# the code used in debug_printer to build parameters is wrong but lets as it is while the work on the generator is not done, to avoid modifing the generated code: we take into account arg_dep in the arguments to print but not in the control string construction code #}
96102
#ifdef DEBUG

src/resources/generator_data/code/fortran/static_sources/A_f_MPI_Init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ void A_f_MPI_Init(int *ret) {
2929
int wi4mpi_rank;
3030
R_MPI_Comm_rank(R_MPI_COMM_WORLD, &wi4mpi_rank);
3131
if (wi4mpi_rank == 0)
32+
#if defined(_MPC) || defined(_OMPI) || defined(_INTEL)
33+
fprintf(
34+
stdout, "You are using Wi4MPI-%s in the interface mode to %s\n",
35+
getenv("WI4MPI_VERSION"), getenv("WI4MPI_TO"));
36+
#else
3237
fprintf(
3338
stdout, "You are using Wi4MPI-%s in the preload mode from %s to %s\n",
3439
getenv("WI4MPI_VERSION"), getenv("WI4MPI_FROM"), getenv("WI4MPI_TO"));
40+
#endif
3541
in_w = 0;
3642
#ifdef DEBUG
3743
if (WI4MPI_Init_print)

src/resources/generator_data/code/fortran/static_sources/A_f_MPI_Init_thread.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ void A_f_MPI_Init_thread(int *required, int *provided, int *ret) {
2121
int wi4mpi_rank;
2222
R_MPI_Comm_rank(R_MPI_COMM_WORLD, &wi4mpi_rank);
2323
if (wi4mpi_rank == 0)
24+
#if defined(_MPC) || defined(_OMPI) || defined(_INTEL)
25+
fprintf(
26+
stdout, "You are using Wi4MPI-%s in the interface mode to %s\n",
27+
getenv("WI4MPI_VERSION"), getenv("WI4MPI_TO"));
28+
#else
2429
fprintf(
2530
stdout, "You are using Wi4MPI-%s in the preload mode from %s to %s\n",
2631
getenv("WI4MPI_VERSION"), getenv("WI4MPI_FROM"), getenv("WI4MPI_TO"));
32+
#endif
2733
in_w = 0;
2834
#ifdef DEBUG
2935
if (WI4MPI_Init_thread_print)

src/resources/generator_data/code/fortran/templates/template_A.jinja

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@
7878
wi4mpi_set_timeout(WI4{{func['name']}}_timeout);
7979
#endif
8080
in_w=1;
81-
{%- if func['name'] == 'MPI_Init' or func['name'] == 'MPI_Init_thread' -%}
82-
int wi4mpi_rank;
83-
R_MPI_Comm_rank(R_MPI_COMM_WORLD, &wi4mpi_rank);
84-
if (wi4mpi_rank == 0)
85-
fprintf(
86-
stdout, "You are using Wi4MPI-%s in the preload mode from %s to %s\n",
87-
getenv("WI4MPI_VERSION"), getenv("WI4MPI_FROM"), getenv("WI4MPI_TO"));
88-
{%- endif -%}
8981
{% if func['heading']|default("") != "" %}
9082
{{func['heading']}}
9183
{% endif %}

0 commit comments

Comments
 (0)