lab2-stephen-stengel.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //Stephen Stengel <stephen.stengel@cwu.edu> 40819903
  2. //Lab2 parallel matrix multiplications
  3. //Using MAX_FILENAME_LEN for a few things.
  4. //my stuff
  5. #include "lab2-stephen-stengel.h"
  6. #include "mylab1functions.h"
  7. int main(int argc, char **argv)
  8. {
  9. printf("Hi!\n");
  10. printf("I already know that N will just be a linear increase, "\
  11. "so this test will just use one value of N for all sub-tests.\n");
  12. checkForHelpCommands(argc, argv);
  13. checkInput(argc, argv);
  14. int maxM = atoi(argv[1]);
  15. int N = atoi(argv[2]);
  16. int maxT = atoi(argv[3]);
  17. //Set up thread pool. Threads are not killed till end of program.
  18. omp_set_num_threads(maxT); //sets the DEFAULT number of threads to create/use in a parallel section.
  19. //~ printf("Max vals...\nM: %d\tN: %d\tT: %d\n", maxM, N, maxT);
  20. //create a filename structure for easy scripting.
  21. char dataDirectory[] = "../data/";
  22. char picsDirectory[] = "../pics/";
  23. //~ testStringPass(dataDirectory);
  24. //CELL//////
  25. char thisDataName[MAX_FILENAME_LEN];
  26. sprintf(thisDataName, "%scell-m%05dn%05dt%05d", dataDirectory, maxM, N, maxT);
  27. char thisPicsName[MAX_FILENAME_LEN];
  28. sprintf(thisPicsName, "%scell-m%05dn%05dt%05d", picsDirectory, maxM, N, maxT);
  29. printf("Data file path and name:\t%s\n", thisDataName);
  30. printf("Pics file path and name:\t%s\n", thisPicsName);
  31. deleteFileIfExists(thisDataName); //So that only data from the current program is saved.
  32. //maybe make a file to keep track of the current version. Then I can use multiple runs of data safely.
  33. char cellString[] = "Cell";
  34. runFuncTest(multSquareArraysThreadCell, thisDataName, thisPicsName, maxM, N, maxT, cellString);
  35. //Might be able to use same filenames and print on same graph with labels? do this for now.
  36. //ROW//////
  37. //~ thisDataName[MAX_FILENAME_LEN];
  38. sprintf(thisDataName, "%srow-m%05dn%05dt%05d", dataDirectory, maxM, N, maxT);
  39. //~ thisPicsName[MAX_FILENAME_LEN];
  40. sprintf(thisPicsName, "%srow-m%05dn%05dt%05d", picsDirectory, maxM, N, maxT);
  41. printf("Data file path and name:\t%s\n", thisDataName);
  42. printf("Pics file path and name:\t%s\n", thisPicsName);
  43. deleteFileIfExists(thisDataName); //So that only data from the current program is saved.
  44. //maybe make a file to keep track of the current version. Then I can use multiple runs of data safely.
  45. char rowString[] = "Row";
  46. runFuncTest(multSquareArraysThreadRow, thisDataName, thisPicsName, maxM, N, maxT, rowString);
  47. //COL//////
  48. //~ thisDataName[MAX_FILENAME_LEN];
  49. sprintf(thisDataName, "%scol-m%05dn%05dt%05d", dataDirectory, maxM, N, maxT);
  50. //~ thisPicsName[MAX_FILENAME_LEN];
  51. sprintf(thisPicsName, "%scol-m%05dn%05dt%05d", picsDirectory, maxM, N, maxT);
  52. printf("Data file path and name:\t%s\n", thisDataName);
  53. printf("Pics file path and name:\t%s\n", thisPicsName);
  54. deleteFileIfExists(thisDataName); //So that only data from the current program is saved.
  55. char colString[] = "Col";
  56. runFuncTest(multSquareArraysThreadCol, thisDataName, thisPicsName, maxM, N, maxT, colString);
  57. return 0;
  58. }
  59. //~ void testStringPass(char dataStr[])//this is also valid as is naming the size
  60. void testStringPass(char * dataStr)
  61. {
  62. printf("The passed string: %s\n", dataStr);
  63. }