Skip to content

How to implement own c/cuda module in cunn and nn? #485

Description

@mbcel

I implemented my own module for the nn/cunn package. Therefore I wrote the MyModule_updateOutput() and MyModule_updateGradInput() functions in the .c and .cu files and I call them from MyModule.lua file.

That all works so far but I have problems or don't know in what files I have to include/register this module. Because I get the error

not found: THNN_CudaMyModule_updateGradInput/home/marcel/torch/install/share/lua/5.1/nn/THNN.lua:108: /home/marcel/torch/install/lib/lua/5.1/libTHCUNN.so: undefined symbol: THNN_CudaMyModule_updateGradInput
not found: THNN_CudaMyModule_updateOutput/home/marcel/torch/install/share/lua/5.1/nn/THNN.lua:108: /home/marcel/torch/install/lib/lua/5.1/libTHCUNN.so: undefined symbol: THNN_CudaMyModule_updateOutput
...
.../install/share/lua/5.1/nn/MyModule.lua:24: attempt to index field 'THNN' (a nil value)

which points to the line that the MyModule_updateOutput() .cu cennot be called in the .lua file because input.THNN is nil.

I registered/included the module here:

  • cunn/generic/THCUNN.h
  • nn/init.lua
  • nn/lib/THNN/init.c
  • nn/lib/THNN/generic/THNN.h

then I build nn first and cunn second.

am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions