Error linking .o with gfortran Trying to execute cuda wrapper

NEVERMIND. Fixed my problem (see next post)

Hello all,

I am trying to create a wrapper to do cula functionality. I am currently on a simple hello world cuda program and am trying to call the program from my .F90 code.

This is what I have so far:

in my .F90 code i have (NOTE that without the below call everything compiles fine.):

call testcu()

testcu is in file update_slabCU.cu, which is this

/**

 * @file update_slabC.c

 * @brief C function for updating a slab (initial phase for LUD on cuda).

 * @remarks this file is intended for testing C functionality

 * which eventually will be used to intiate CUDA.

 */

#include <aio.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include <errno.h>

#include <unistd.h>

#include <string.h>

#include <stdio.h>

#include <stdlib.h>

#include <stdint.h>

#include "update_slabCU.h"

#include <time.h>

#include <strings.h>

#include <cuda.h>

void testcu_(void)

{

    printf("Hello World CUDA\n");

}

void update_slabcu_(int num_rows, int left_mcol, int * left_slab, int lda, int  upd_mcol, int * upd_slab, int ldp, int this_image) {

printf("Hello World\n");

}

I have a update_slabCU.h file as well, which is this:

#ifndef update_slabCU_H

#define update_slabCU_H

extern "C" void update_slabcu_(int num_rows, int left_mcol, int * left_slab,    int lda, int    upd_mcol, int * upd_slab, int ldp, int this_image);

extern "C" void testcu_(void);

#endif

Here is the basic Makefile that has been created:

The makefile successfully compiles cudastuff, and the .o is placed in the fortran compilation area

Note: CC = nvcc, and FC = gfortran

.SUFFIXES: .F90 .c .cu

all: cudastuff $(OBJS) $(LIB_NAME)

cudastuff:

.cu.o:

    $(CC) $(CFLAGS) $(CPRE) -c $< -o $@ -I./

$(LIB_NAME): $(OBJS)

    ar cru $(LIB_NAME) $(OBJS); cp $(LIB_NAME) ../../../Lib/$(LIB_NAME)

    cp *.mod ../../Modules/

    cd ../../../Lib; ar cru libooclud.a ../Src/LUD/Objs/*.o

.F90.o:

    $(FC) update_slabCU.o -L /usr/local/cuda/lib -I /usr/local/cuda/include -   lcuda -lcudart -lstdc++ $(FFLAGS) $(FPRE) $(FDEBUGFLAGS) -c $< -o $@            $(MODINC)../../Modules

.c.o:

    $(CC) $(CFLAGS) $(CPRE) -c $< -o $@ -I./

clean:

    @echo '|--- Cleaning LUD/Objs Directory ---|'

    rm -f $(OBJS) $(MODS) *.i

    @echo '|--- Cleaning Modules Directory ---|'

    cd ../../Modules; rm -f $(MODS)

    @echo '|--- Cleaning Lib Directory ---|'

    @rm -f $(LIB_NAME)

    cd ../../../Lib; rm -f $(LIB_NAME)

Here is the error that I am getting when compiling:

[

Any help would be greatly appreciated.

Let me know if you need to see any more information.

ALSO:

I am using

and

NEVERMIND!!

After writing and submitting the above post I was able to rethink what I was doing, and upon reanalysis of the error I realized I forgot to include some of the LDLIBS for the linking phase.

It works now.