summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a21fe8e)
raw | patch | inline | side by side (parent: a21fe8e)
author | Jianzhong Xu <a0869574@ti.com> | |
Mon, 2 Mar 2015 19:42:37 +0000 (14:42 -0500) | ||
committer | Jianzhong Xu <a0869574@ti.com> | |
Mon, 2 Mar 2015 19:42:37 +0000 (14:42 -0500) |
openCL error with HPC drop 8.)
examples/matmpy/Makefile | patch | blob | history | |
examples/matmpy/main.c | patch | blob | history |
index e766082a217c4adc7da224810e044a0b934c3757..86f9bf45632fd348549f6c2ae0fd5ae9496cb2f3 100644 (file)
--- a/examples/matmpy/Makefile
+++ b/examples/matmpy/Makefile
-
EXE = matmpy
include ../make.inc
$(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);
+
+
diff --git a/examples/matmpy/main.c b/examples/matmpy/main.c
index a97ed7d02687aa2b2b75166a1daba32cc531c340..993c6bedb2ed707d427135121d3fac633899a57b 100644 (file)
--- a/examples/matmpy/main.c
+++ b/examples/matmpy/main.c
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) {
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");
- free(A);
- free(B);
- free(C);
+ __free_ddr(A);
+ __free_ddr(B);
+ __free_ddr(C);
return 1;
}
/* 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);
printf("Result CHECKSUM: %16.4f\n", checksum);
- free(A);
- free(B);
- free(C);
+ __free_ddr(A);
+ __free_ddr(B);
+ __free_ddr(C);
return 0;
}