Commit e2238dd6 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing multi array CUDA test.

parent aa8a40f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ VERBOSE="VERBOSE=1"

CMAKE="cmake"
CPUS=`grep -c processor /proc/cpuinfo`
CPUS="1"
#CPUS="1"


echo "Building $TARGET using $CPUS processors."
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <fstream>
#include <iomanip>
#include <core/tnlLogger.h>
#include <tnlConfig.h>

void tnlLogger :: WriteHeader( const tnlString& title )
{
+10 −1
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ ADD_EXECUTABLE( tnlArrayTest${mpiExt}${debugExt} ${headers} tnlArrayTest.cpp )
TARGET_LINK_LIBRARIES( tnlArrayTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
                                                           tnl${mpiExt}${debugExt}-0.1 )
                                                           
ADD_EXECUTABLE( tnlMultiArrayTest${mpiExt}${debugExt} ${headers} tnlMultiArrayTest.cpp )
TARGET_LINK_LIBRARIES( tnlMultiArrayTest${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
                                                           tnl${mpiExt}${debugExt}-0.1 )

             
if( BUILD_CUDA )
    CUDA_ADD_EXECUTABLE( tnlArrayOperationsTest-cuda${mpiExt}${debugExt} ${headers} tnlArrayOperationsTest.cu 
@@ -23,5 +27,10 @@ if( BUILD_CUDA )
    TARGET_LINK_LIBRARIES( tnlArrayTest-cuda${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
                                                              tnl${mpiExt}${debugExt}-0.1 )
                                                              
    CUDA_ADD_EXECUTABLE( tnlMultiArrayTest-cuda${mpiExt}${debugExt} ${headers} tnlMultiArrayTest.cu
                         OPTIONS -arch sm_20 -shared )
    TARGET_LINK_LIBRARIES( tnlMultiArrayTest-cuda${mpiExt}${debugExt} ${CPPUNIT_LIBRARIES}
                                                              tnl${mpiExt}${debugExt}-0.1 )                                                                
                                                                                                                                                                                                                                                            
endif()
                                                                       
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@
 *                                                                         *
 ***************************************************************************/

#ifndef TNLARRAYMANAGERTESTER_H_
#define TNLARRAYMANAGERTESTER_H_
#ifndef TNLARRAYTESTER_H_
#define TNLARRAYTESTER_H_

#ifdef HAVE_CPPUNIT
#include <cppunit/TestSuite.h>
@@ -214,7 +214,7 @@ class tnlArrayTester : public CppUnit :: TestCase
template< typename ElementType, typename IndexType >
__global__ void testSetGetElementKernel( tnlArray< ElementType, tnlCuda, IndexType >* u )
{
   if( threadIdx.x < 10 )
   if( threadIdx.x < ( *u ).getSize() )
      ( *u )[ threadIdx.x ] = threadIdx.x;
}
#endif /* HAVE_CUDA */
@@ -224,4 +224,4 @@ template< typename ElementType, typename Device, typename IndexType >
class tnlArrayTester{};
#endif /* HAVE_CPPUNIT */

#endif /* TNLARRAYMANAGERTESTER_H_ */
#endif /* TNLARRAYTESTER_H_ */
+64 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlMultiArrayTest.cpp  -  description
                             -------------------
    begin                : Feb 3, 2014
    copyright            : (C) 2014 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include <tnlConfig.h>
#include <core/tnlHost.h>
#include <cstdlib>

#include "tnlMultiArrayTester.h"
#include "../../tnlUnitTestStarter.h"

int main( int argc, char* argv[] )
{
#ifdef HAVE_CPPUNIT
   if( ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, char, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, long int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, float, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, double, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, char, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, long int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, float, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 1, double, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, char, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, long int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, float, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, double, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, char, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, long int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, float, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 2, double, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, char, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, float, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, double, tnlHost, int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, char, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, long int, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, float, tnlHost, long int > >() ||
       ! tnlUnitTestStarter :: run< tnlMultiArrayTester< 3, double, tnlHost, long int > >()
       )
     return EXIT_FAILURE;
   return EXIT_SUCCESS;
#else
   return EXIT_FAILURE;
#endif
}
Loading