# Re: CMake and CUDA

**URL:** <https://www.ruby-forum.com/t/re-cmake-and-cuda/241639>\
**Category:** GNU Radio\
**Created:** [April 20, 2015, 7:44pm UTC](https://www.ruby-forum.com/t/re-cmake-and-cuda/241639 "2015-04-20T19:44:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [April 20, 2015, 7:44pm UTC](https://www.ruby-forum.com/t/re-cmake-and-cuda/241639/1 "2015-04-20T19:44:20Z")

</div>

I try to give more details.  
In order to create blocks using the standard way(cmake/make/install)  
with  
Cuda,I’ve modified the CMakeList in /lib as shown before. My block is  
created using gr\_modtool and the language is c++.  
The fact is that “make test” works well,while in GnuRadio interface give  
me  
the following error AttributeError: ‘module’ object has no attribute  
‘helloFunc\_ff’.  
Everything worked well before the addition of CUDA code(so it’s not the  
problem experienced by other users)

Thanks,  
Marco

cmake\_minimum\_required(VERSION 2.8)  
find\_package(CUDA)

include(GrPlatform) #define LIB\_SUFFIX

include\_directories(${Boost\_INCLUDE\_DIR})  
link\_directories(${Boost\_LIBRARY\_DIRS})

list(APPEND helloBlock\_sources  
mod\_ff\_impl.cc helloCUDA.cu  
)

set(helloBlock\_sources “${helloBlock\_sources}” PARENT\_SCOPE)

cuda\_add\_library(gnuradio-helloBlock SHARED ${helloBlock\_sources})  
target\_link\_libraries(gnuradio-helloBlock ${Boost\_LIBRARIES}  
${GNURADIO\_ALL\_LIBRARIES}  
${CUDA\_LIBRARIES})  
set\_target\_properties(gnuradio-helloBlock PROPERTIES DEFINE\_SYMBOL  
“gnuradio\_helloBlock\_EXPORTS”)  
…

---

<div class="post-metadata">

**Author:** ![marco\_Ribero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@marco\_Ribero](https://www.ruby-forum.com/u/marco_Ribero)\
**Post date:** [April 21, 2015, 4:42pm UTC](https://www.ruby-forum.com/t/re-cmake-and-cuda/241639/2 "2015-04-21T16:42:18Z")

</div>

On Mon, Apr 20, 2015 at 1:42 PM, marco Ribero  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Thanks,  
> link\_directories(${Boost\_LIBRARY\_DIRS})  
> ${GNURADIO\_ALL\_LIBRARIES}  
> ${CUDA\_LIBRARIES})  
> set\_target\_properties(gnuradio-helloBlock PROPERTIES DEFINE\_SYMBOL  
> “gnuradio\_helloBlock\_EXPORTS”)  
> …

Have you checked the library itself to see if the block exists there?  
‘nm  
-C lib.so | grep helloBlock’ should tell you if it was  
properly built into your library.

Tom

---

<div class="post-metadata">

**Author:** ![marco\_Ribero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@marco\_Ribero](https://www.ruby-forum.com/u/marco_Ribero)\
**Post date:** [April 23, 2015, 11:42pm UTC](https://www.ruby-forum.com/t/re-cmake-and-cuda/241639/3 "2015-04-23T23:42:41Z")

</div>

Thank you very much for your reply.  
I’ve launched your command over the library  
build/lib/libgnuradio-hhh.so  
(is the unique in this folder), generated using cmake/make/sudo…  
Entries seems ok.

Output of nm -C | grep over the basic version(without CUDA):

> **[00000000000042d0 t gr::hhh::mod\_ff\_impl::general\_work(int, std::vector](https://pastebin.com/QJSvXLpz)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Output of nm -C | grep over the version with CUDA(a simple memcpy,the  
block  
works perfectly with make test)

> **[0000000000004530 t gr::hhh::mod\_ff\_impl::general\_work(int, std::vector](https://pastebin.com/9BXvv6X3)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

They seems equal(except addresses)

The name of the project is hhh(gr-hhh),and the block is mod(mod\_ff),  
sorry  
for names…

This is the log given by gnuradio:  
Traceback (most recent call last):  
File “/home/marco/Scrivania/gnuradio/top\_block.py”, line 203, in  
  
tb = top\_block()  
File “/home/marco/Scrivania/gnuradio/top\_block.py”, line 162, in  
**init**  
self.hhh\_mod\_ff\_0 = hhh.mod\_ff()  
AttributeError: ‘module’ object has no attribute ‘mod\_ff’  
Reattached kernel driver

Thanks for your effort,  
marco

Il giorno mar 21 apr 2015 alle ore 16:37 Tom R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
ha  
scritto:
