- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a big(ish) fluids simulation code written in fortran which is compiled with ifort to run on 2 Xeon v4s. I am also trying gpu acceleration using C interface routines (with iso C bindings) and of late I am trying to use a couple nvidia teslas for acceleration.
When compiling the C part of the code with gcc, ifort will link with the object files and nvidia libraries (cufft, cublas). But having to write my own kernels it is necessary to be able compiling with nvcc. When doing so, ifort cannot find any of the C routines.
A search for similar queries produced no recent posts on the subject and the older suggestions seem not to work. It seems odd that this issue may be unresolved given the dominance intel processors. A similar question on the nvidia site produced a wave of apathy.
Any suggestions?
Thanks.
--
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without seeing an example of your code (perhaps a small reproducer?), it is difficult to say what might be going wrong. We have CFD code that uses Fortran and CUDA (and hence nvcc) that builds fine on Windows and Linux, but we don't use ISO C binding (because the code predated Fortran 2003 support).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
CUDA code behaves like C++ by default, so you need to declare your functions with extern "C", i.e.
#include <stdio.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
extern "C" void anything_( double A[], int *Nin )
{
int i;
for( i=1; i<*Nin; i++ ) {
printf("\n i, A(i) = %d %f ", i, A[i] );
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks again. Flagged my post as solution instead of yours. Dimnation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This did the trick. Thank you v much.
==
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page