Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6957 Discussions

missing fftw functions (fftwnd_f77_mpi_ etc.)

Fruchtl__Herbert
1,444 Views
This question was asked last summer by somebody else on a different Intel forum. The poster was referred to the MKL forum, but I can't find an answer here.

Compilation of a program (Wien2k in my case) with composer_xe_2011_sp1.6.233 (including MPI) and the included fftw2 wrappers fails with

fftw_para.o: In function `exec_fftw_para_':
fftw_para.F:(.text+0x77): undefined reference to `fftwnd_f77_mpi_'
fftw_para.F:(.text+0xb2): undefined reference to `fftwnd_f77_mpi_'
fftw_para.o: In function `init_fftw_para_':
fftw_para.F:(.text+0x101): undefined reference to `fftw3d_f77_mpi_create_plan_'
fftw_para.F:(.text+0x131): undefined reference to `fftw3d_f77_mpi_create_plan_'
fftw_para.F:(.text+0x159): undefined reference to `fftwnd_f77_mpi_local_sizes_'

The fftw libraries I compiled in the wrappers directory are libfftw2xf_intel.a and libfftw2x_cdft_DOUBLE.a.

Any suggestions?

Thanks in advance,

Herbert
0 Kudos
5 Replies
Chao_Y_Intel
Moderator
1,444 Views

Hi Herbert,

I noticed these symbols are not there. I will check with engineer owner and provide some update.

Thanks,
Chao

0 Kudos
Vladimir_Petrov__Int
New Contributor III
1,444 Views
Hi Herbert,

Indeed, the trailing underscores are missing in the F77 interface wrappers provided with this version of MKL.

In order to work around this problem you may consider changing the F77 function names in the wrappers adding the underscore (e.g. fftw_f77_mpi -> fftw_f77_mpi_) manually or via applying the patch below:

===========
--- wrappers/1d_create_plan.c
+++ wrappers/1d_create_plan.c
@@ -64,7 +64,7 @@ error2:
return NULL;
}

-void fftw_f77_mpi_create_plan(fftw_mpi_plan *plan, MPI_Comm *comm, int *n, int *idir, int *flags) {
+void fftw_f77_mpi_create_plan_(fftw_mpi_plan *plan, MPI_Comm *comm, int *n, int *idir, int *flags) {

*plan = fftw_mpi_create_plan(MPI_Comm_f2c(comm), *n, (*idir)<0 ? FFTW_FORWARD : FFTW_BACKWARD, *flags);
}
--- wrappers/1d_destroy_plan.c
+++ wrappers/1d_destroy_plan.c
@@ -42,6 +42,6 @@ void fftw_mpi_destroy_plan(fftw_mpi_plan
free(p);
}

-void fftw_f77_mpi_destroy_plan(fftw_mpi_plan *p) {
+void fftw_f77_mpi_destroy_plan_(fftw_mpi_plan *p) {
fftw_mpi_destroy_plan(*p);
}
--- wrappers/1d_fftw.c
+++ wrappers/1d_fftw.c
@@ -52,6 +52,6 @@ error:
return;
}

-void fftw_f77_mpi(fftw_mpi_plan *p, int *n, void *local, void *work, int *use_work) {
+void fftw_f77_mpi_(fftw_mpi_plan *p, int *n, void *local, void *work, int *use_work) {
fftw_mpi(*p, *n, local, (*use_work)?work:NULL);
}
--- wrappers/1d_local_sizes.c
+++ wrappers/1d_local_sizes.c
@@ -53,6 +53,6 @@ error:
return;
}

-void fftw_f77_mpi_local_sizes(fftw_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size) {
+void fftw_f77_mpi_local_sizes_(fftw_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size) {
fftw_mpi_local_sizes(*p, n, start, n_out, start_out, size);
}
--- wrappers/nd_create_plan.c
+++ wrappers/nd_create_plan.c
@@ -68,7 +68,7 @@ error2:
return NULL;
}

-void fftw2d_f77_mpi_create_plan(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, fftw_direction *dir, int *flags)
+void fftw2d_f77_mpi_create_plan_(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, fftw_direction *dir, int *flags)
{
*plan = fftw2d_mpi_create_plan(MKL_Comm_c2f(MPI_COMM_WORLD), *ny, *nx, *dir, *flags);
}
@@ -107,7 +107,7 @@ error2:
return NULL;
}

-void fftw3d_f77_mpi_create_plan(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, int *nz, fftw_direction *dir, int *flags)
+void fftw3d_f77_mpi_create_plan_(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, int *nz, fftw_direction *dir, int *flags)
{
*plan = fftw3d_mpi_create_plan(MKL_Comm_c2f(MPI_COMM_WORLD), *nz, *ny, *nx, *dir, *flags);
}
@@ -151,7 +151,7 @@ error2:
return NULL;
}

-void fftwnd_f77_mpi_create_plan(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *dim, int *nn, fftw_direction *dir, int *flags)
+void fftwnd_f77_mpi_create_plan_(fftwnd_mpi_plan *plan, MPI_Comm *comm, int *dim, int *nn, fftw_direction *dir, int *flags)
{
REVERSE_INT_ARRAY(nn,*dim);
*plan = fftwnd_mpi_create_plan(MKL_Comm_c2f(MPI_COMM_WORLD), *dim, nn, *dir, *flags);
--- wrappers/nd_destroy_plan.c
+++ wrappers/nd_destroy_plan.c
@@ -41,7 +41,7 @@ void fftwnd_mpi_destroy_plan(fftwnd_mpi_
free(p);
}

-void fftwnd_f77_mpi_destroy_plan(fftwnd_mpi_plan* p)
+void fftwnd_f77_mpi_destroy_plan_(fftwnd_mpi_plan* p)
{
fftwnd_mpi_destroy_plan(*p);
}
--- wrappers/nd_fftw.c
+++ wrappers/nd_fftw.c
@@ -56,7 +56,7 @@ error2:
return;
}

-void fftwnd_f77_mpi(fftwnd_mpi_plan *p, int *n, void *local, void *work, int *use_work, fftwnd_mpi_output_order *output_order)
+void fftwnd_f77_mpi_(fftwnd_mpi_plan *p, int *n, void *local, void *work, int *use_work, fftwnd_mpi_output_order *output_order)
{
fftwnd_mpi(*p, *n, local, (*use_work)?work:NULL, *output_order);
}
--- wrappers/nd_local_sizes.c
+++ wrappers/nd_local_sizes.c
@@ -54,6 +54,6 @@ error:
return;
}

-void fftwnd_f77_mpi_local_sizes(fftwnd_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size) {
+void fftwnd_f77_mpi_local_sizes_(fftwnd_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size) {
fftwnd_mpi_local_sizes(*p, n, start, n_out, start_out, size);
}
--- wrappers/rnd_create_plan.c
+++ wrappers/rnd_create_plan.c
@@ -80,7 +80,7 @@ error2:
return NULL;
}

-void rfftw2d_f77_mpi_create_plan(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, fftw_direction *dir, int *flags)
+void rfftw2d_f77_mpi_create_plan_(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, fftw_direction *dir, int *flags)
{
*plan = rfftw2d_mpi_create_plan(MPI_Comm_f2c(comm), *ny, *nx, *dir, *flags);
}
@@ -130,7 +130,7 @@ error2:
return NULL;
}

-void rfftw3d_f77_mpi_create_plan(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, int *nz, fftw_direction *dir, int *flags)
+void rfftw3d_f77_mpi_create_plan_(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *nx, int *ny, int *nz, fftw_direction *dir, int *flags)
{
*plan = rfftw3d_mpi_create_plan(MPI_Comm_f2c(comm), *nz, *ny, *nx, *dir, *flags);
}
@@ -194,7 +194,7 @@ error2:
return NULL;
}

-void rfftwnd_f77_mpi_create_plan(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *dim, int *nn, fftw_direction *dir, int *flags)
+void rfftwnd_f77_mpi_create_plan_(rfftwnd_mpi_plan *plan, MPI_Comm *comm, int *dim, int *nn, fftw_direction *dir, int *flags)
{
REVERSE_INT_ARRAY(nn,*dim);
*plan = rfftwnd_mpi_create_plan(MPI_Comm_f2c(comm), *dim, nn, *dir, *flags);
--- wrappers/rnd_destroy_plan.c
+++ wrappers/rnd_destroy_plan.c
@@ -42,7 +42,7 @@ void rfftwnd_mpi_destroy_plan(rfftwnd_mp
free(p);
}

-void rfftwnd_f77_mpi_destroy_plan(rfftwnd_mpi_plan* p)
+void rfftwnd_f77_mpi_destroy_plan_(rfftwnd_mpi_plan* p)
{
rfftwnd_mpi_destroy_plan(*p);
}
--- wrappers/rnd_fftw.c
+++ wrappers/rnd_fftw.c
@@ -71,7 +71,7 @@ error2:
return;
}

-void rfftwnd_f77_mpi(rfftwnd_mpi_plan *p, int *n, void *local, void *work, int *use_work, fftwnd_mpi_output_order *output_order)
+void rfftwnd_f77_mpi_(rfftwnd_mpi_plan *p, int *n, void *local, void *work, int *use_work, fftwnd_mpi_output_order *output_order)
{
rfftwnd_mpi(*p, *n, local, (*use_work)?work:NULL, *output_order);
}
--- wrappers/rnd_local_sizes.c
+++ wrappers/rnd_local_sizes.c
@@ -53,7 +53,7 @@ error:
return;
}

-void rfftwnd_f77_mpi_local_sizes(rfftwnd_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size)
+void rfftwnd_f77_mpi_local_sizes_(rfftwnd_mpi_plan *p,MKL_INT *n,MKL_INT *start,MKL_INT *n_out,MKL_INT *start_out, MKL_INT *size)
{
rfftwnd_mpi_local_sizes(*p, n, start, n_out, start_out, size);
}
=================

Other solutions might be to compile your code with "-assume nounderscore" (which may be a bad idea in case of Wien2k), or to use objcopy to rename the symbols inquestions to add underscore.

We may consider changing this in one of our future releases.

Best regards,
Vladimir
0 Kudos
Gennady_F_Intel
Moderator
1,444 Views
Herbert,
This issue has been submitted to our internal development tracking database for further investigation, we will inform you once a new update becomes available.
Here is a bug tracking number for your reference: DPD200272909
--Gennady
0 Kudos
Fruchtl__Herbert
1,444 Views
Could I have some more detailed instructions how patching works? When I copy that into a file "patch" and execute

patch

in the directory composer_xe_2011_sp1.6.233/mkl/interfaces/fftw2x_cdft (because that's from where the filenames in the file seem to be declared), it doesn't find the files to patch:
=====
[root@wardlaw10 fftw2x_cdft]# patch --dry-run
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- wrappers/1d_create_plan.c
|+++ wrappers/1d_create_plan.c
--------------------------
File to patch:
=====
What am I doing wrong?

Thanks in advance,

Herbert

0 Kudos
Vladimir_Petrov__Int
New Contributor III
1,444 Views
Hi Herbert,

It worked for me with
patch -p0

Best regards,
Vladimir
0 Kudos
Reply