# How to construct a CNN with a new layer and How should I run CUDA tests to check whether they pass or fail?

**URL:** <https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537>\
**Category:** TMVA\
**Created:** [April 2, 2018, 5:09am UTC](https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537 "2018-04-02T05:09:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshit.prasad](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/harshit.prasad/32/15805_2.png) [@harshit.prasad](https://root-forum.cern.ch/u/harshit.prasad)\
**Post date:** [April 2, 2018, 5:09am UTC](https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537/1 "2018-04-02T05:09:36Z")

</div>

Hello everyone,

I need some help regarding constructing a CNN with a new layer (Average Pooling Layer) and running CUDA tests to check whether they pass or fail. I am trying to solve the tasks given for GSoC’18 in which one task is related to implementing Average Pooling Layer and another task is related to implementing Im2Col function that works on CUDA.

To report the results, I have to create a CNN with a new layer. How should I create it?

For Im2Col function, I have written code by creating new file name _TestIm2ColCuda.cxx_. When I run `ctest -j4 -R TMVA-DNN*` I get this:

 ![08%20AM](https://root-forum.cern.ch/uploads/default/original/3X/b/d/bd94b9df80e014f7a80b487ffd375ee72a65ac61.jpg)

which means I’m not testing the CUDA tests written. It is only testing CPU support. How should I test CUDA part ?

It will be great if anyone can help me out so that I can proceed further and understand the TMVA-DNN project structure. 🙂

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 4, 2018, 9:02am UTC](https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537/2 "2018-04-04T09:02:03Z")

</div>

Hi,

If you want to add new tests, you should include them in the corresponding  
CMAKELists.txt file in tmva/tmva/test/DNN

However this topic is specific to the CNN GSOC project and it should be discussed by mail directly there with the project mentors  
Best Regards

Lorenzo

---

<div class="post-metadata">

**Author:** ![harshit.prasad](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/harshit.prasad/32/15805_2.png) [@harshit.prasad](https://root-forum.cern.ch/u/harshit.prasad)\
**Post date:** [April 7, 2018, 8:35am UTC](https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537/3 "2018-04-07T08:35:05Z")

</div>

Greetings @moneta,

I have already written tests for _Im2Col_ function in CUDA in the corresponding CMAKELists.txt file in tmva/tmva/test/DNN

Stil I’m not able to figure out why I’m not able to see GPU tests when I run `ctest -j4 -R TMVA-DNN*` command in terminal.

I have earlier tried to discuss this issue through the mail, but there was no response. Your guidance will be very much helpful.

Cheers,

Harshit

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [April 9, 2018, 4:10pm UTC](https://root-forum.cern.ch/t/how-to-construct-a-cnn-with-a-new-layer-and-how-should-i-run-cuda-tests-to-check-whether-they-pass-or-fail/28537/4 "2018-04-09T16:10:22Z")

</div>

Hi,

GPU is supported now only for the DNN (Dense layer networks) and not for CNN.  
To have the GPU support for DNN you need to enable in CMAKE with -DCUDA=On

Lorenzo
