Ejemplo n.º 1
0
/**
 * Check whether a special "help" flag was given in the arguments, and also
 * print a warning (Using ArLog at Normal log level) if any unparsed arguments were found.   
 * The following are the help flags: -help, -h, --help, /?, /h.  
 * @return false if a help flag was found or unparsed arguments 
 * were found, true otherwise.
 * @param numArgsOkay If you plan on checking for additional 
 *  arguments later in the program, you can specify the number of arguments
 *  expected here, which prevents this method from warning about them being unparsed
 *  yet.
 */
AREXPORT bool ArArgumentParser::checkHelpAndWarnUnparsed(
	unsigned int numArgsOkay)
{
  
  if (myHelp || checkArgument("-help") || checkArgument("-h") || 
      checkArgument("/?") || checkArgument("/h"))
  {
    myHelp = true;
    return false;
  }
      
  if (getArgc() <= 1 + numArgsOkay)
    return true;

  size_t i;
  char buf[2048];
  sprintf(buf, "Unhandled arguments to program:");
  for (i = 1 + (int)numArgsOkay; i < getArgc(); i++)
    sprintf(buf, "%s %s", buf, getArg(i));
  ArLog::log(ArLog::Normal, buf);
  ArLog::log(ArLog::Normal, 
	   "Program will continue but to see the help listing type '%s -help'",
	     getArg(0));
  return true;
}
Ejemplo n.º 2
0
AREXPORT void ArArgumentParser::log(void) const
{
  size_t i;
  ArLog::log(ArLog::Terse, "Num arguments: %d", getArgc());
  for (i = 0; i < getArgc(); ++i)
    ArLog::log(ArLog::Terse, "Arg %d: %s", i, getArgv()[i]);
}
Ejemplo n.º 3
0
/**
   @param argument the string to check for. If the argument is found,
   then it is removed from the argument list

   @param returnFirst true if we should just take the first matching argument,
   or false if we should iterate through the list and only use the last one
   (default is false, use true if you want to use the same parameter
   multiple times)

   @return NULL if the argument wasn't found; the value given after the
   found argument; or at empty string (with a NULL first character) if
   the argument was found but no value followed the argument flag.
**/
AREXPORT char * ArArgumentParser::checkParameterArgument(const char *argument,
							 bool returnFirst)
{
  char *ret;
  char *retRecursive;
  size_t i;
  std::string extraHyphen;

  extraHyphen = "-";
  extraHyphen += argument;

  for (i = 0; i < getArgc(); i++)
  {
    if (strcasecmp(argument, getArgv()[i]) == 0 ||
	strcasecmp(extraHyphen.c_str(), getArgv()[i]) == 0)
    {
      // see if we have a ret, we don't if the ret would be beyond argc
      if (getArgc() > i+1)
      {
	ret = getArgv()[i+1];
      }
      else
      {
	ret = myEmptyArg;
      }
      // remove our argument
      removeArg(i);
      // if we have a return remove that one too
      if (ret != NULL && ret != myEmptyArg)
	removeArg(i);
      // now see if there are any more, if so return that
      if (returnFirst)
      {
	return ret;
      }
      else if ((retRecursive = checkParameterArgument(argument)) != NULL)
      {
	return retRecursive;
      }
      // otherwise return what we found
      else
      {
	return ret;
      }
    }
  }
  return NULL;
}
Ejemplo n.º 4
0
AREXPORT const char* ArArgumentParser::getArg(size_t whichArg) const
{
  if (whichArg >= getArgc())
    return NULL;
  else
    return getArgv()[whichArg];
}
Ejemplo n.º 5
0
void ArArgumentParser::removeArg(size_t which)
{
  if (which >= getArgc())
  {
    ArLog::log(ArLog::Terse, "ArArgumentParser::removeArg: %d is greater than the number of arguments which is %d", which, getArgc());
    return;
  }
  if (myUsingBuilder)
    {
      myBuilder->removeArg(which);
    }
  else
    {
      size_t i;
      for (i = which; i < getArgc() - 1; i++)
	myArgv[i] = myArgv[i+1];
      *myArgc -= 1;
    }
}
Ejemplo n.º 6
0
ocrGuid_t mainEdt ( u32 paramc, u64* paramv, u32 depc, ocrEdtDep_t depv[]) {
    u64 size = -1;
    u64 offset = -1;
    u32 i = 0;
    u64 argc;

    void *programArg = depv[0].ptr;
    argc = getArgc(programArg);
    if ( argc !=  4 ) {
        PRINTF("Usage: ./basicIO offset size fileName \n");
        ocrShutdown();
        return 1;
    }

    offset = atoi(getArgv(programArg, 1));
    size = atoi(getArgv(programArg, 2));
    u64 nparamv[2];
    nparamv[0] = offset;
    nparamv[1] = size;
    FILE *in;
    in = fopen(getArgv(programArg, 3), "r");
    if( !in ) {
        PRINTF("Cannot find file: %s\n", getArgv(programArg, 3));
        ocrShutdown();
        return NULL_GUID;
    }
    ocrGuid_t dataGuid;
    // Data can be passed as parameter also , there was no
    // necessary need of creating data block  in this example.
    // Its has been created for demo purpose
    //Create datablock to hold a block of 'size' elements
    u64 *inputarr;
    ocrDbCreate(&dataGuid, (void**)&inputarr, sizeof(u64)*size,0,NULL_GUID, NO_ALLOC);
#ifndef TG_ARCH
    while(fscanf(in,"%llu\n",&inputarr[i++])!=EOF);
#else
    fread(inputarr, sizeof(u64),size , in);

#endif
    fclose(in);

    ocrGuid_t addEdtTemplateGuid;
    ocrEdtTemplateCreate(&addEdtTemplateGuid, add_edt, 2 /*paramc*/, 1 /*depc*/);
    ocrGuid_t add_edt_guid;
    // Create the EDT not specifying the dependence vector at creation
    ocrEdtCreate(&add_edt_guid, addEdtTemplateGuid, EDT_PARAM_DEF, nparamv,1,NULL ,EDT_PROP_FINISH , NULL_GUID, NULL);

    ocrGuid_t triggerEventGuid;
    ocrEventCreate(&triggerEventGuid, OCR_EVENT_STICKY_T, true);

    ocrAddDependence(triggerEventGuid, add_edt_guid, 0, DB_MODE_EW);
    ocrEventSatisfy(triggerEventGuid, dataGuid);
    return NULL_GUID;
}
Ejemplo n.º 7
0
void Vm::callModule(const SObject &instance, const SObject &funcName) {
  auto module = std::dynamic_pointer_cast<Module>(instance);
  auto size = module->getArgc(funcName);
  VecSObject p;
  while (size--) {
    auto v = VM_POP();
    p.push_back(v);
  }
  auto ob = Module::call(instance, funcName, p);
  if (ob != nullptr) {
    VM_PUSH(ob);
  }
}
Ejemplo n.º 8
0
/**
   @param argument the string to check for, if the argument is found
   its pulled from the list of arguments

   @param ... the extra string to feed into the argument for parsing
   (like printf)

   @return true if the argument was found, false otherwise
**/
AREXPORT bool ArArgumentParser::checkArgument(const char *argument)
{
  size_t i;
  std::string extraHyphen;
  extraHyphen = "-";
  extraHyphen += argument;
  for (i = 0; i < getArgc(); i++)
  {
    if (strcasecmp(argument, getArgv()[i]) == 0 ||
	strcasecmp(extraHyphen.c_str(), getArgv()[i]) == 0)
    {
      removeArg(i);
      // MPL took this out so you could add the same arg multiple times
      //checkArgument(argument);
      return true;
    }
  }
  return false;
}
Ejemplo n.º 9
0
void parseArgs()
{
	char** argv = getArgs();
	int argc = getArgc();
	if (argc == 1) { console = true; return; }

	zoneToBuild = string(argv[1]);

	for (int i = 2; i < argc;  i++)
	{
		if (!strcmp("-b", argv[i])) build = true;
		if (!strcmp("-v", argv[i])) verify = true;
		if (!strncmp("-s", argv[i], 2))
		{
			sources.push_back(string(argv[i] + 2));
		}
		if (!strncmp("-d", argv[i], 2))
		{
			fs_basegame = strdup(argv[i] + 2);
		}
	}
	if (!console && !build && !verify) printUsage();
}
Ejemplo n.º 10
0
    bool WindowLinux::init()
    {
        std::shared_ptr<graphics::RendererOGL> rendererOGL = std::static_pointer_cast<graphics::RendererOGL>(sharedEngine->getRenderer());

        // open a connection to the X server
        display = XOpenDisplay(nullptr);

        if (!display)
        {
            ouzel::log("Failed to open display");
            return false;
        }

        int screen = DefaultScreen(display);

        XVisualInfo* vi = nullptr;

        // make sure OpenGL's GLX extension supported
        int dummy;
        if (!glXQueryExtension(display, &dummy, &dummy))
        {
            ouzel::log("X server has no OpenGL GLX extension");
            return false;
        }

        int fbcount = 0;

        static const int attributes[] = {
            GLX_RENDER_TYPE, GLX_RGBA_BIT,
            GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
            GLX_DOUBLEBUFFER, GL_TRUE,
            GLX_RED_SIZE, 1,
            GLX_GREEN_SIZE, 1,
            GLX_BLUE_SIZE, 1,
            None
        };

        GLXFBConfig* framebufferConfig = glXChooseFBConfig(display, screen, attributes, &fbcount);
        if (!framebufferConfig)
        {
            ouzel::log("Failed to get frame buffer");
        }
        else
        {
            // create an OpenGL rendering context
            static const int contextAttribs[] = {
                GLX_CONTEXT_PROFILE_MASK_ARB,
                GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
                GLX_CONTEXT_MAJOR_VERSION_ARB,
                3,
                GLX_CONTEXT_MINOR_VERSION_ARB,
                2,
                None
            };

            PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB"));

            if (glXCreateContextAttribsARB)
            {
                context = glXCreateContextAttribsARB(display, framebufferConfig[0], NULL, GL_TRUE, contextAttribs);

                if (context)
                {
                    rendererOGL->setAPIVersion(3);
                    log("Using OpenGL 3.2");

                    vi = glXGetVisualFromFBConfig(display, framebufferConfig[0]);

                    if (!vi)
                    {
                        ouzel::log("Failed to get OpenGL visual");
                        context = nullptr;
                    }
                }
                else
                {
                    log("Failed to crete OpenGL 3.2 rendering context");
                }
            }
            else
            {
                log("Could not find glXCreateContextAttribsARB");
            }
        }

        if (!context)
        {
            // find an OpenGL-capable RGB visual with depth buffer
            static int doubleBuffer[] = {GLX_RGBA, GLX_DEPTH_SIZE, 16, GLX_DOUBLEBUFFER, None};

            vi = glXChooseVisual(display, screen, doubleBuffer);
            if (!vi)
            {
                ouzel::log("Failed to choose OpenGL visual");
                return false;
            }
            if (vi->c_class != TrueColor)
            {
                ouzel::log("TrueColor visual required for this program");
                return false;
            }

            context = glXCreateContext(display, vi, None, GL_TRUE);

            if (context)
            {
                rendererOGL->setAPIVersion(2);
                log("Using OpenGL 2");
            }
            else
            {
                log("Failed to crete OpenGL 2 rendering context");
                return false;
            }
        }

        // create an X colormap since probably not using default visual
        Colormap cmap = XCreateColormap(display, RootWindow(display, vi->screen), vi->visual, AllocNone);
        XSetWindowAttributes swa;
        swa.colormap = cmap;
        swa.border_pixel = 0;
        swa.event_mask = KeyPressMask | KeyRelease | ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | StructureNotifyMask;
        window = XCreateWindow(display, RootWindow(display, vi->screen), 0, 0,
                               static_cast<unsigned int>(size.width), static_cast<unsigned int>(size.height), 0,
                               vi->depth, InputOutput, vi->visual,
                               CWBorderPixel | CWColormap | CWEventMask, &swa);
        XSetStandardProperties(display, window, title.c_str(), title.c_str(), None, getArgv(), getArgc(), nullptr);

        // bind the rendering context to the window
        glXMakeCurrent(display, window, context);

        // request the X window to be displayed on the screen
        XMapWindow(display, window);

        PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXSwapIntervalEXT"));

        if (glXSwapIntervalEXT)
        {
            glXSwapIntervalEXT(display, window, sharedEngine->getSettings().verticalSync ? 1 : 0);
        }

        return Window::init();
    }
extern "C" ocrGuid_t mainEdt(u32 paramc, u64* paramv, u32 depc, ocrEdtDep_t depv[]) {
	u64 argc = getArgc(depv[0].ptr);
	int i;
	char *argv[argc];
	for(i=0;i<argc;i++) {
		argv[i] = getArgv(depv[0].ptr,i);
	}

	u64 N;
	u64 iterations;
	bool verify;
	bool verbose;
	bool printResults;
	u64 serialBlockSize = SERIAL_BLOCK_SIZE_DEFAULT;
	if(!parseOptions(argc,argv,&N,&verify,&iterations,&verbose,&printResults,&serialBlockSize)) {
		printHelp(argv,true);
		ocrShutdown();
		return NULL_GUID;
	}
	if(verbose) {
		for(i=0;i<argc;i++) {
			PRINTF("argv[%d]: %s\n",i,argv[i]);
		}
	}
	if(iterations > 1 && verbose) {
		PRINTF("Running %d iterations\n",iterations);
	}

	ocrGuid_t startTempGuid,endTempGuid,printTempGuid,endSlaveTempGuid,iterationTempGuid;
	ocrEdtTemplateCreate(&iterationTempGuid, &fftIterationEdt, 7, 4);
	ocrEdtTemplateCreate(&startTempGuid, &fftStartEdt, 9, 3);
	ocrEdtTemplateCreate(&endTempGuid, &fftEndEdt, 9, 5);
	ocrEdtTemplateCreate(&endSlaveTempGuid, &fftEndSlaveEdt, 5, 3);
	ocrEdtTemplateCreate(&printTempGuid, &finalPrintEdt, 3, 5);
	
	float *x_in;
	// Output for the FFT
	float *X_real;
	float *X_imag;
	ocrGuid_t dataInGuid,dataRealGuid,dataImagGuid,timeDataGuid;
	// TODO: OCR cannot handle large datablocks
	DBCREATE(&dataInGuid, (void **) &x_in, sizeof(float) * N, 0, NULL_GUID, NO_ALLOC);
	DBCREATE(&dataRealGuid, (void **) &X_real, sizeof(float) * N, 0, NULL_GUID, NO_ALLOC);
	DBCREATE(&dataImagGuid, (void **) &X_imag, sizeof(float) * N, 0, NULL_GUID, NO_ALLOC);
	if(verbose) {
		PRINTF("3 Datablocks of size %lu (N=%lu) created\n",sizeof(float)*N,N);
	}
	
	for(i=0;i<N;i++) {
		x_in[i] = 0;
		X_real[i] = 0;
		X_imag[i] = 0;
	}
	x_in[1] = 1;
	//x_in[3] = -1;
	//x_in[5] = 1;
	//x_in[7] = -1;

	
	// Create an EDT out of the EDT template
	ocrGuid_t edtGuid, edtPrevGuid, printEdtGuid, edtEventGuid, edtPrevEventGuid;
	//ocrEdtCreate(&edtGuid, startTempGuid, EDT_PARAM_DEF, edtParamv, EDT_PARAM_DEF, NULL_GUID, EDT_PROP_FINISH, NULL_GUID, &edtEventGuid);

	std::stack<ocrGuid_t> edtStack;
	std::stack<ocrGuid_t> eventStack;
	edtEventGuid = NULL_GUID;
	edtPrevEventGuid = NULL_GUID;

	for(i=1;i<=iterations;i++) {
		u64 edtParamv[7] = { startTempGuid, endTempGuid, endSlaveTempGuid, N, verbose, serialBlockSize, i };
		ocrEdtCreate(&edtGuid, iterationTempGuid, EDT_PARAM_DEF, edtParamv, EDT_PARAM_DEF, NULL_GUID, EDT_PROP_FINISH, NULL_GUID, &edtEventGuid);
		edtStack.push(edtGuid);
		eventStack.push(edtEventGuid);
	}

	edtEventGuid = eventStack.top();
	if(verify) {
		edtEventGuid = setUpVerify(dataInGuid, dataRealGuid, dataImagGuid, N, edtEventGuid);
	}
	double *startTime;
	DBCREATE(&timeDataGuid, (void **) &startTime, sizeof(double), 0, NULL_GUID, NO_ALLOC);
	*startTime = mysecond();
	u64 edtParamv[3] = { N, verbose, printResults };
	// Create finish EDT, with dependence on last EDT
	ocrGuid_t finishDependencies[5] = { edtEventGuid, dataInGuid, dataRealGuid, dataImagGuid, timeDataGuid };
	ocrEdtCreate(&printEdtGuid, printTempGuid, EDT_PARAM_DEF, edtParamv, EDT_PARAM_DEF, finishDependencies, EDT_PROP_NONE, NULL_GUID, NULL);
	eventStack.pop();	

	while(!edtStack.empty()) {
		edtGuid = edtStack.top();
		if(!eventStack.empty()) {
			edtEventGuid = eventStack.top();
		} else {
			edtEventGuid = NULL_GUID;
		}
		ocrAddDependence(dataInGuid, edtGuid, 0, DB_MODE_RO);
		ocrAddDependence(dataRealGuid, edtGuid, 1, DB_MODE_ITW);
		ocrAddDependence(dataImagGuid, edtGuid, 2, DB_MODE_ITW);
		ocrAddDependence(edtEventGuid, edtGuid, 3, DB_MODE_RO);
		edtStack.pop();
		eventStack.pop();
	}

	return NULL_GUID;
}
extern "C" ocrGuid_t mainEdt(u32 paramc, u64* paramv, u32 depc, ocrEdtDep_t depv[]) {
	u64 argc = getArgc(depv[0].ptr);
	int i;
	char *argv[argc];
	for(i=0;i<argc;i++) {
		argv[i] = getArgv(depv[0].ptr,i);
	}

	u64 N;
	u64 iterations;
	bool verify;
	bool verbose;
	bool printResults;
	u64 serialBlockSize = SERIAL_BLOCK_SIZE_DEFAULT;
	if(!parseOptions(argc,argv,&N,&verify,&iterations,&verbose,&printResults,&serialBlockSize)) {
		printHelp(argv,true);
		ocrShutdown();
		return NULL_GUID;
	}
	if(verbose) {
		for(i=0;i<argc;i++) {
			PRINTF("argv[%d]: %s\n",i,argv[i]);
		}
		PRINTF("Running %d iterations\n",iterations);
	}

	ocrGuid_t iterationTempGuid,startTempGuid,endTempGuid,printTempGuid,endSlaveTempGuid;
	ocrEdtTemplateCreate(&iterationTempGuid, &fftIterationEdt, 6, 2);
	ocrEdtTemplateCreate(&startTempGuid, &fftStartEdt, 9, 1);
	ocrEdtTemplateCreate(&endTempGuid, &fftEndEdt, 9, 3);
	ocrEdtTemplateCreate(&endSlaveTempGuid, &fftEndSlaveEdt, 5, 1);
	ocrEdtTemplateCreate(&printTempGuid, &finalPrintEdt, 3, 2);
	
	// x_in, X_real, and X_imag in a contiguous block
	float *x;
	ocrGuid_t dataGuid;
	// TODO: OCR cannot handle large datablocks
	DBCREATE(&dataGuid, (void **) &x, sizeof(float) * N * 3, 0, NULL_GUID, NO_ALLOC);
	if(verbose) {
		PRINTF("Datablock of size %lu (N=%lu) created\n",sizeof(float)*N*3,N);
	}
	
	for(i=0;i<N;i++) {
		x[i] = 0;
	}
	x[1] = 1;
	//x[3] = -3;
	//x[4] = 8;
	//x[5] = 9;
	//x[6] = 1;


	std::stack<ocrGuid_t> edtStack;
	std::stack<ocrGuid_t> eventStack;
	u64 edtParamv[6] = { startTempGuid, endTempGuid, endSlaveTempGuid, N, verbose, serialBlockSize };

	ocrGuid_t edtGuid, printEdtGuid, edtEventGuid;

	for(i=1;i<=iterations;i++) {
		ocrEdtCreate(&edtGuid, iterationTempGuid, EDT_PARAM_DEF, edtParamv, EDT_PARAM_DEF, NULL_GUID, EDT_PROP_FINISH, NULL_GUID, &edtEventGuid);
		edtStack.push(edtGuid);
		eventStack.push(edtEventGuid);
	}

	edtEventGuid = eventStack.top();
	if(verify) {
		edtEventGuid = setUpVerify(dataGuid, NULL_GUID, NULL_GUID, N, edtEventGuid);
	}

	u64 printParamv[3] = { N, verbose, printResults };
	ocrGuid_t finishDependencies[2] = { edtEventGuid, dataGuid };
	ocrEdtCreate(&printEdtGuid, printTempGuid, EDT_PARAM_DEF, printParamv, EDT_PARAM_DEF, finishDependencies, EDT_PROP_NONE, NULL_GUID, NULL);
	eventStack.pop();
	
	while(!edtStack.empty()) {
		edtGuid = edtStack.top();
		if(!eventStack.empty()) {
			edtEventGuid = eventStack.top();
		} else {
			edtEventGuid = NULL_GUID;
		}
		ocrAddDependence(dataGuid, edtGuid, 0, DB_MODE_ITW);
		ocrAddDependence(edtEventGuid, edtGuid, 1, DB_MODE_RO);
		edtStack.pop();
		eventStack.pop();
	}

	return NULL_GUID;
}
Ejemplo n.º 13
0
ocrGuid_t mainEdt(u32 paramc, u64 *paramv, u32 depc, ocrEdtDep_t depv[]) {
    u32 matrixSize = -1;
    u32 tileSize = -1;
    u32 numTiles = -1;
    u32 i, j, k, c;
    u32 outSelLevel = 2;
    double **matrix, ** temp;
    u64 argc;

    void *programArg = depv[0].ptr;
    argc = getArgc(programArg);

    char *nparamv[argc];

    char *fileNameIn, *fileNameOut = "ocr_mkl_cholesky.out";

    for (i=0; i< argc; i++)
    {
        nparamv[i] = getArgv(programArg, i);
    }

    if ( argc == 1) {
        PRINTF("OCR-MKL Cholesky\n");
        PRINTF("__________________________________________________________________________________________________\n");
        PRINTF("Solves an OCR version of a Tiled Cholesky Decomposition with all math kernels using Intel MKL only\n\n");
        PRINTF("Usage:\n");
        PRINTF("\tocr_mkl_cholesky.exe {Arguments}\n\n");
        PRINTF("Arguments:\n");
        PRINTF("\t--ds -- Specify the Size of the Input Matrix\n");
        PRINTF("\t--ts -- Specify the Tile Size\n");
        PRINTF("\t--fi -- Specify the Input File Name of the Matrix\n");
//        PRINTF("\t--fo -- Specify an Output File Name (default: ocr_mkl_cholesky.out)\n");
        PRINTF("\t--ol -- Output Selection Level:\n");
        PRINTF("\t\t0: Print solution to stdout\n");
        PRINTF("\t\t1: Write solution to text file\n");
        PRINTF("\t\t2: Write solution to binary file (default)\n");
        PRINTF("\t\t3: Write solution to text file and print to stdout\n");
        PRINTF("\t\t4: Write solution to binary file and print to stdout\n");
        PRINTF("\t\t5: Write algorithm timing data to ocr_mkl_cholesky_stats.csv and write solution to binary file\n");

        ocrShutdown();
        return NULL_GUID;
    }
    else
    {
        // Reads in 4 arguments, input matrix file name, output matrix filename, datasize, and tilesize
        while (1)
        {
            static struct option long_options[] =
                {
                    {"ds", required_argument, 0, 'a'},
                    {"ts", required_argument, 0, 'b'},
                    {"fi", required_argument, 0, 'c'},
                    {"fo", required_argument, 0, 'd'},
                    {"ol", required_argument, 0, 'e'},
                    {0, 0, 0, 0}
                };

            u32 option_index = 0;

            c = getopt_long(argc, nparamv, "a:b:c:d:e", long_options, &option_index);

            if (c == -1) // Detect the end of the options
                break;
            switch (c)
            {
            case 'a':
                //PRINTF("Option a: matrixSize with value '%s'\n", optarg);
                matrixSize = (u32) atoi(optarg);
                break;
            case 'b':
                //PRINTF("Option b: tileSize with value '%s'\n", optarg);
                tileSize = (u32) atoi(optarg);
                break;
            case 'c':
                //PRINTF("Option c: fileNameIn with value '%s'\n", optarg);
                fileNameIn = optarg;
                break;
            case 'd':
                //PRINTF("Option d: fileNameOut with value '%s'\n", optarg);
                fileNameOut = (char*) mkl_realloc(fileNameOut, sizeof(optarg));
                strcpy(fileNameOut, optarg);
                break;
            case 'e':
                //PRINTF("Option e: outSelLevel with value '%s'\n", optarg);
                outSelLevel = (u32) atoi(optarg);
                break;
            default:
                PRINTF("ERROR: Invalid argument switch\n\n");
                PRINTF("OCR-MKL Cholesky\n");
                PRINTF("__________________________________________________________________________________________________\n");
                PRINTF("Solves an OCR version of a Tiled Cholesky Decomposition with all math kernels using Intel MKL only\n\n");
                PRINTF("Usage:\n");
                PRINTF("\tocr_mkl_cholesky.exe {Arguments}\n\n");
                PRINTF("Arguments:\n");
                PRINTF("\t--ds -- Specify the Size of the Input Matrix\n");
                PRINTF("\t--ts -- Specify the Tile Size\n");
                PRINTF("\t--fi -- Specify the Input File Name of the Matrix\n");
//                PRINTF("\t--fo -- Specify an Output File Name (default: ocr_mkl_cholesky.out)\n");
                PRINTF("\t--ol -- Output Selection Level:\n");
                PRINTF("\t\t0: Print solution to stdout\n");
                PRINTF("\t\t1: Write solution to text file\n");
                PRINTF("\t\t2: Write solution to binary file (default)\n");
                PRINTF("\t\t3: Write solution to text file and print to stdout\n");
                PRINTF("\t\t4: Write solution to binary file and print to stdout\n");
                PRINTF("\t\t5: Write algorithm timing data to ocr_mkl_cholesky_stats.csv and write solution to binary file\n");

                ocrShutdown();
                return NULL_GUID;
            }
        }
    }

    if(matrixSize == -1 || tileSize == -1)
    {
        PRINTF("Must specify matrix size and tile size\n");
        ocrShutdown();
        return NULL_GUID;
    }
    else if(matrixSize % tileSize != 0)
    {
        PRINTF("Incorrect tile size %d for the matrix of size %d \n", tileSize, matrixSize);
        ocrShutdown();
        return NULL_GUID;
    }

    numTiles = matrixSize/tileSize;

    PRINTF("Matrixsize %d, tileSize %d\n", matrixSize, tileSize);

#ifndef TG_ARCH
    struct timeval a;
    if(outSelLevel == 5)
    {
        FILE* outCSV = fopen("ocr_mkl_cholesky_stats.csv", "r");
        if( !outCSV )
        {

            outCSV = fopen("ocr_mkl_cholesky_stats.csv", "w");

            if( !outCSV ) {
                PRINTF("Cannot find file: %s\n", "ocr_mkl_cholesky_stats.csv");
                ocrShutdown();
                return NULL_GUID;
            }

            fprintf(outCSV, "MatrixSize,TileSize,NumTile,PreAllocTime,PreAlgorithmTime,PostAlgorithmTime\n");
        }
	else
        {
            outCSV = fopen("ocr_mkl_cholesky_stats.csv", "a+");
        }

        fprintf(outCSV, "%d,%d,%d,", matrixSize, tileSize, numTiles);
        gettimeofday(&a, 0);
        fprintf(outCSV, "%f,", (a.tv_sec*1000000+a.tv_usec)*1.0/1000000);
        fclose(outCSV);
    }

    FILE *in;
    in = fopen(fileNameIn, "r");
    if( !in ) {
        PRINTF("Cannot find file: %s\n", fileNameIn);
        ocrShutdown();
        return NULL_GUID;
    }

    matrix = readMatrix(matrixSize, in);

    if(outSelLevel == 5)
    {
        FILE* outCSV = fopen("ocr_mkl_cholesky_stats.csv", "a");
        if( !outCSV ) {
            PRINTF("Cannot find file: %s\n", "ocr_mkl_cholesky_stats.csv");
            ocrShutdown();
            return NULL_GUID;
        }
        gettimeofday(&a, 0);
        fprintf(outCSV, "%f,", (a.tv_sec*1000000+a.tv_usec)*1.0/1000000);
        fclose(outCSV);
    }
#endif


    ocrGuid_t*** lkji_event_guids = allocateCreateEvents(numTiles);

    ocrGuid_t templateSeq, templateTrisolve,
        templateUpdateNonDiag, templateUpdate, templateWrap;

    ocrEdtTemplateCreate(&templateSeq, lapacke_dpotrf_task, 3, 1);
    ocrEdtTemplateCreate(&templateTrisolve, cblas_dtrsm_task, 4, 2);
    ocrEdtTemplateCreate(&templateUpdateNonDiag, cblas_dgemm_task, 5, 3);
    ocrEdtTemplateCreate(&templateUpdate, cblas_dsyrk_task, 5, 2);
    ocrEdtTemplateCreate(&templateWrap, wrap_up_task, 3, (numTiles+1)*numTiles/2);

//    PRINTF("Going to satisfy initial tiles\n");
#ifdef TG_ARCH
    satisfyInitialTiles(numTiles, tileSize, lkji_event_guids);
#else
    satisfyInitialTiles(numTiles, tileSize, matrix, lkji_event_guids);
#endif

    for ( k = 0; k < numTiles; ++k ) {
//        PRINTF("Prescribing sequential task %d\n", k);
        lapacke_dpotrf_task_prescriber(templateSeq, k, tileSize, lkji_event_guids);

        for( j = k + 1 ; j < numTiles ; ++j ) {
            cblas_dtrsm_task_prescriber (templateTrisolve,
                                          k, j, tileSize, lkji_event_guids);

            for( i = k + 1 ; i < j ; ++i ) {
                cblas_dgemm_task_prescriber (templateUpdateNonDiag,
                                              k, j, i, tileSize, lkji_event_guids);
            }
            cblas_dsyrk_task_prescriber (templateUpdate,
                                          k, j, i, tileSize, lkji_event_guids);
        }
    }

    wrap_up_task_prescriber (templateWrap, numTiles, tileSize,
                             outSelLevel, lkji_event_guids);

//    PRINTF("Wrapping up mainEdt\n");
    return NULL_GUID;
}