Ajout des cas de tests pour les TP non-graphiques. Cleanage en tous genres.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / main.cpp
index 397a133..5e56e8a 100755 (executable)
@@ -1,15 +1,14 @@
 #include <iostream>
+#include <vector>
 #include <stdlib.h>
 #include <assert.h>
+using namespace std;
 
 #include "cudaTools.h"
 #include "Device.h"
 #include "cudaTools.h"
 #include "GLUTImageViewers.h"
 
-using std::cout;
-using std::endl;
-
 /*----------------------------------------------------------------------*\
  |*                    Declaration                                     *|
  \*---------------------------------------------------------------------*/
@@ -18,7 +17,7 @@ using std::endl;
  |*            Imported                *|
  \*-------------------------------------*/
 
-extern int mainGL(void);
+extern int mainGL(const vector<string>& args);
 extern int mainFreeGL(void);
 
 /*--------------------------------------*\
@@ -31,7 +30,7 @@ int main(int argc, char** argv);
  |*            Private                 *|
  \*-------------------------------------*/
 
-static int start(void);
+static int start(const vector<string>& args);
 static void initCuda(int deviceId);
 
 /*----------------------------------------------------------------------*\
@@ -57,7 +56,11 @@ int main(int argc, char** argv)
        // Server Cuda2: in [0,2]
        int deviceId = 0;
 
-       int isOk = start();
+       vector<string> args;
+       for (int i = 1; i < argc; ++i)
+           args.push_back(argv[i]);
+
+       int isOk = start(args);
 
        //cudaDeviceReset causes the driver to clean up all state.
        // While not mandatory in normal operation, it is good practice.
@@ -84,7 +87,7 @@ void initCuda(int deviceId)
     // Choose current device  (state of host-thread)
     HANDLE_ERROR(cudaSetDevice(deviceId));
 
-    // Enable Interoperabilité OpenGL:
+    // Enable Interoperabilit OpenGL:
     //         - Create a cuda specifique contexte, shared between Cuda and GL
     //         - To be called before first call to kernel
     //         - cudaSetDevice ou cudaGLSetGLDevice are mutualy exclusive
@@ -95,7 +98,7 @@ void initCuda(int deviceId)
     // Device::loadCudaDriverAll();// Force driver to be load for all GPU
     }
 
-int start(void)
+int start(const vector<string>& args)
     {
     Device::printCurrent();
 
@@ -103,7 +106,7 @@ int start(void)
 
     if (IS_GL)
        {
-       return mainGL(); // Bloquant, Tant qu'une fenetre est ouverte
+       return mainGL(args); // Bloquant, Tant qu'une fenetre est ouverte
        }
     else
        {