Hi
I hope you are doing good. i am trying to make a function inside a fortran code from which i wish to call the cusparse and cublas initialization functions.
This is because i notice that initialising these libraries everytime requires quite some time (around 1-2 secs) when my entire application runs in 0.25 secs. Also since i am doing this inside a time loop i want to avoid doing initialisation every timestep as otherwise i have to count this time in my timing results.
I have read about the fortran wrappers that are provided in cusparse_fortran.c and fortran.c but i cannot seem to be able to compile them since i use ifort 13.1.1 20130313 and i get an error when i include the fortran.c in my makefile
In file included from fortran.c:67:
fortran_common.h:405:2: error: #error unsupported Fortran compiler
I know how to make a wrapper in C which can be called from fortran but now i wish to move a cusparse call into fortran code and i do not know how can the handles (which are structures in C) be declared in fortran then passed to a subroutine in fortran where the handles are instantiated and later pointers to these handles are passed to a wrapper routine which uses these handles to do some blas and cusparse operations.
///////////general structure of what i want to do
Fortran code
! declare cusparseHandle_t cuprshndl and cublasHandle_t cublshndl
! call initiate_handles (cuprshndl, cublshndl)
! call c_wrapper(…, …, …, ccuprshndl, cublshndl)
C code
c_wrapper(…, …, …, *ccuprshndl, *cublshndl)
{
// calls different cublas functions and cusparse functions using these handles passed from the fortran code.
}
}