]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - dense-linear-algebra-libraries/linalg.git/commitdiff
Test matmpy on ARM and DSP. (hard coded to test on ARM for now, due to 0.0.2.0
authorJianzhong Xu <a0869574@ti.com>
Mon, 2 Mar 2015 19:42:37 +0000 (14:42 -0500)
committerJianzhong Xu <a0869574@ti.com>
Mon, 2 Mar 2015 19:42:37 +0000 (14:42 -0500)
openCL error with HPC drop 8.)

examples/matmpy/Makefile
examples/matmpy/main.c

index e766082a217c4adc7da224810e044a0b934c3757..86f9bf45632fd348549f6c2ae0fd5ae9496cb2f3 100644 (file)
@@ -1,4 +1,3 @@
-
 EXE = matmpy
 
 include ../make.inc
 EXE = matmpy
 
 include ../make.inc
@@ -6,14 +5,22 @@ include ../make.inc
 $(EXE): main.o
        $(CC) $(CFLAGS) main.o $(BLASLIB) -o $@
 
 $(EXE): main.o
        $(CC) $(CFLAGS) main.o $(BLASLIB) -o $@
 
-fulltest: $(EXE)
-       @export TI_CBLAS_OFFLOAD=000; \
-       echo "Forcing execution on ARM."; \
-       ./$(EXE); \
-       @export TI_CBLAS_OFFLOAD=011; \
-       echo "Forcing execution on DSP."; \
-       ./$(EXE) \
-       @export TI_CBLAS_OFFLOAD=022; \
-       echo "Optimal execution on ARM or DSP."; \
-       ./$(EXE)
+alltests: ARMtest DSPtest OPTtest
+
+ARMtest: $(EXE)
+       @echo "Forcing execution on ARM."; \
+       export TI_CBLAS_OFFLOAD=000; \
+        ./$(EXE);
+
+DSPtest: $(EXE)
+       @echo "Forcing execution on DSP."; \
+       export TI_CBLAS_OFFLOAD=001; \
+       ./$(EXE);
+
+OPTtest: $(EXE)
+       @echo "Optimal execution on ARM or DSP."; \
+       export TI_CBLAS_OFFLOAD=002; \
+       ./$(EXE);
+
+
 
 
index a97ed7d02687aa2b2b75166a1daba32cc531c340..993c6bedb2ed707d427135121d3fac633899a57b 100644 (file)
@@ -22,8 +22,9 @@ double secs = 0.0;
 
 static void report_flops(double secs, int m, int n, int k, int N)
 {
 
 static void report_flops(double secs, int m, int n, int k, int N)
 {
-  fprintf(fout,"Total time for %d tests: %8.6fs, %5.3f Mflops\n",
-          N, secs, (float)N*m*n*(2*k-1) / (secs * 1e6));
+  fprintf(fout,"Total time for %d tests: %8.6fs, %5.3f Gflops\n",
+//          N, secs, (float)N*m*n*(2*k-1) / (secs * 1e6));
+          N, secs, (float)N*2*m*n*k / (secs * 1e9));
 }
 
 double matrix_mult(void) {
 }
 
 double matrix_mult(void) {
@@ -65,14 +66,14 @@ int main()
        beta  = 1.3; 
 
     /* allocate the matrices */
        beta  = 1.3; 
 
     /* allocate the matrices */
-    A = (double *)malloc( m*k*sizeof( double ) );
-    B = (double *)malloc( k*n*sizeof( double ) );
-    C = (double *)malloc( m*n*sizeof( double ) );
+    A = (double *)__malloc_ddr( m*k*sizeof( double ) );
+    B = (double *)__malloc_ddr( k*n*sizeof( double ) );
+    C = (double *)__malloc_ddr( m*n*sizeof( double ) );
     if (A == NULL || B == NULL || C == NULL) {
       printf( "\nERROR: Can't allocate memory for matrices. Aborting... \n\n");
     if (A == NULL || B == NULL || C == NULL) {
       printf( "\nERROR: Can't allocate memory for matrices. Aborting... \n\n");
-      free(A);
-      free(B);
-      free(C);
+      __free_ddr(A);
+      __free_ddr(B);
+      __free_ddr(C);
       return 1;
     }
        
       return 1;
     }
        
@@ -85,7 +86,11 @@ int main()
     /* Check the environment variable that controls offloading */
     ti_cblas_offload_env = getenv("TI_CBLAS_OFFLOAD");
     if(ti_cblas_offload_env == NULL) {
     /* Check the environment variable that controls offloading */
     ti_cblas_offload_env = getenv("TI_CBLAS_OFFLOAD");
     if(ti_cblas_offload_env == NULL) {
-      printf("TI_CBLAS_OFFLOAD is not defined.\n");
+      printf("Environment variable TI_CBLAS_OFFLOAD is not defined. ");
+      printf("Use default offloading configuration:\n");
+         printf("\tBLAS level 1: running on ARM.\n");
+         printf("\tBLAS level 2: running on ARM.\n");
+         printf("\tBLAS level 3: running on ARM or DSP based on matrix sizes.\n");
     }
     else {
       printf("TI_CBLAS_OFFLOAD is defined as %s\n", ti_cblas_offload_env);
     }
     else {
       printf("TI_CBLAS_OFFLOAD is defined as %s\n", ti_cblas_offload_env);
@@ -106,9 +111,9 @@ int main()
 
     printf("Result CHECKSUM: %16.4f\n", checksum);
 
 
     printf("Result CHECKSUM: %16.4f\n", checksum);
 
-    free(A);
-    free(B);
-    free(C);
+    __free_ddr(A);
+    __free_ddr(B);
+    __free_ddr(C);
 
     return 0;
 }
 
     return 0;
 }