chore: init
This commit is contained in:
48
Student_Cuda_Tools_Reduction/src/main/main.cpp
Executable file
48
Student_Cuda_Tools_Reduction/src/main/main.cpp
Executable file
@@ -0,0 +1,48 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "CudaContext.h"
|
||||
#include "Limits.h"
|
||||
|
||||
using std::cout;
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Imported *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
extern int mainUse();
|
||||
extern int mainTest();
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Implementation *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
int main(int argc , char** argv)
|
||||
{
|
||||
// Limits::show();
|
||||
|
||||
CudaContext cudaContext;
|
||||
|
||||
// public
|
||||
{
|
||||
cudaContext.deviceId = 0; // in [0,2] width Server Cuda3
|
||||
cudaContext.launchMode = LaunchModeMOO::USE; // USE TEST (only)
|
||||
|
||||
cudaContext.deviceDriver = DeviceDriver::LOAD_ALL; // LOAD_CURRENT LOAD_ALL
|
||||
cudaContext.deviceInfo = DeviceInfo::ALL_SIMPLE; // NONE ALL ALL_SIMPLE CURRENT
|
||||
}
|
||||
|
||||
// private
|
||||
{
|
||||
cudaContext.mainUse = mainUse;
|
||||
cudaContext.mainTest = mainTest;
|
||||
}
|
||||
|
||||
return cudaContext.process();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* End *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
72
Student_Cuda_Tools_Reduction/src/main/mainTest.cpp
Executable file
72
Student_Cuda_Tools_Reduction/src/main/mainTest.cpp
Executable file
@@ -0,0 +1,72 @@
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
// add
|
||||
#include "VTReductionAddIntI.h"
|
||||
#include "VTReductionAddIntII.h"
|
||||
|
||||
// generic
|
||||
#include "VTReductionGenericI.h"
|
||||
#include "VTReductionGenericII.h"
|
||||
#include "VTReductionGenericLongII.h"
|
||||
|
||||
using std::string;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Declaration *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
static void add();
|
||||
static void generic();
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Implementation *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
int mainTest()
|
||||
{
|
||||
// activer ci-dessous seulement le TP voulu (pas tous)
|
||||
|
||||
add();
|
||||
//generic();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/*--------------------------------------*\
|
||||
|* private *|
|
||||
\*-------------------------------------*/
|
||||
|
||||
/**
|
||||
* activer ci-dessous la version souhaiter
|
||||
*/
|
||||
void add()
|
||||
{
|
||||
VTReductionAddIntI test1;
|
||||
VTReductionAddIntII test2;
|
||||
|
||||
test1.run();
|
||||
//test2.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* activer ci-dessous la version souhaiter
|
||||
*/
|
||||
void generic()
|
||||
{
|
||||
VTReductionGenericI test1;
|
||||
VTReductionGenericII test2;
|
||||
VTReductionGenericLongII test3;
|
||||
|
||||
test1.run();
|
||||
// test2.run();
|
||||
// test3.run();
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* End *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
110
Student_Cuda_Tools_Reduction/src/main/mainUse.cpp
Executable file
110
Student_Cuda_Tools_Reduction/src/main/mainUse.cpp
Executable file
@@ -0,0 +1,110 @@
|
||||
#include <iostream>
|
||||
#include <stdlib.h>
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
#include "Couts.h"
|
||||
|
||||
// ReductionTools add
|
||||
#include "UseReductionAddIntI.h"
|
||||
#include "UseReductionAddIntII.h"
|
||||
|
||||
// ReductionTools generic
|
||||
#include "UseReductionIntI.h"
|
||||
#include "UseReductionIntII.h"
|
||||
#include "UseReductionLongII.h"
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* declaration *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
static void reduction_add(bool& isOk);
|
||||
static void reduction_generic(bool& isOk);
|
||||
|
||||
static void print(bool isSuccess);
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Implementation *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
static const int IS_VERBOSE = true;
|
||||
|
||||
int mainUse()
|
||||
{
|
||||
// activer ci-dessous seulement le TP voulu (pas tous)
|
||||
|
||||
bool isOk = true;
|
||||
|
||||
reduction_add(isOk); // voir code ci-dessous pour activer la version voulue
|
||||
//reduction_generic(isOk); // voir code ci-dessous pour activer la version voulue
|
||||
|
||||
print(isOk);
|
||||
|
||||
return isOk ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* TP *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* activer ci-dessous la version souhaiter
|
||||
*/
|
||||
void reduction_add(bool& isOk)
|
||||
{
|
||||
// InbI
|
||||
{
|
||||
UseReductionAddIntI algo(IS_VERBOSE);
|
||||
isOk &= algo.isOk(IS_VERBOSE);
|
||||
}
|
||||
|
||||
// IntII
|
||||
// {
|
||||
// UseReductionAddIntII algo(IS_VERBOSE);
|
||||
// isOk &= algo.isOk(IS_VERBOSE);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* activer ci-dessous la version souhaiter
|
||||
*/
|
||||
void reduction_generic(bool& isOk)
|
||||
{
|
||||
// InbI
|
||||
{
|
||||
UseReductionIntI algo(IS_VERBOSE);
|
||||
isOk &= algo.isOk(IS_VERBOSE);
|
||||
}
|
||||
|
||||
// IntII
|
||||
{
|
||||
UseReductionIntII algo(IS_VERBOSE);
|
||||
isOk &= algo.isOk(IS_VERBOSE);
|
||||
}
|
||||
|
||||
// LongII
|
||||
{
|
||||
UseReductionLongII algo(IS_VERBOSE);
|
||||
isOk &= algo.isOk(IS_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* Tools *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
void print(bool isSuccess)
|
||||
{
|
||||
cout << endl << Couts::REVERSE;
|
||||
|
||||
Couts::status(isSuccess, "Success, Congratulations !", "Failed, sorry!");
|
||||
|
||||
cout << endl << Couts::RESET;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
|* End *|
|
||||
\*---------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user