Home | History | Annotate | Download | only in blasbenchmark
      1 /*
      2  * Copyright (C) 2015 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.example.android.rs.blasbenchmark;
     18 
     19 import android.app.Activity;
     20 import android.view.View;
     21 import android.util.Log;
     22 
     23 public class BlasTestList {
     24     private final String TAG = "BLAS";
     25     public final String RESULT_FILE = "blas_benchmark_result.csv";
     26 
     27     /**
     28      * Define enum type for test names
     29      */
     30     public enum TestName {
     31 
     32         SGEMM_SMALL ("SGEMM Test Small", 1.f),
     33         SGEMM_MEDIUM ("SGEMM Test Medium", 1.f),
     34         SGEMM_LARGE ("SGEMM Test LARGE", 1.f),
     35         BNNM_SMALL ("8Bit GEMM Test Small", 1.f),
     36         BNNM_MEDIUM ("8Bit GEMM Test Medium", 1.f),
     37         BNNM_LARGE ("8Bit GEMM Test Large", 1.f),
     38         SGEMM_GoogLeNet ("GoogLeNet SGEMM Test", 1.f),
     39         BNNM_GoogLeNet ("GoogLeNet BNNM Test", 1.f),
     40         SGEMM_GoogLeNet_Padded ("GoogLeNet SGEMM Test Padded", 1.f),
     41         BNNM_GoogLeNet_Padded ("GoogLeNet BNNM Test Padded", 1.f);
     42 
     43         private final String name;
     44         public final float baseline;
     45 
     46         private TestName(String s, float base) {
     47             name = s;
     48             baseline = base;
     49         }
     50         private TestName(String s) {
     51             name = s;
     52             baseline = 1.f;
     53         }
     54 
     55         // return quoted string as displayed test name
     56         public String toString() {
     57             return name;
     58         }
     59     }
     60 
     61     static TestBase newTest(TestName testName) {
     62         switch(testName) {
     63         case SGEMM_SMALL:
     64             return new SGEMMTest(1);
     65         case SGEMM_MEDIUM:
     66             return new SGEMMTest(2);
     67         case SGEMM_LARGE:
     68             return new SGEMMTest(3);
     69         case BNNM_SMALL:
     70             return new BNNMTest(1);
     71         case BNNM_MEDIUM:
     72             return new BNNMTest(2);
     73         case BNNM_LARGE:
     74             return new BNNMTest(3);
     75         case SGEMM_GoogLeNet:
     76             return new GoogLeNet(1);
     77         case BNNM_GoogLeNet:
     78             return new GoogLeNet(2);
     79         case SGEMM_GoogLeNet_Padded:
     80             return new GoogLeNet(3);
     81         case BNNM_GoogLeNet_Padded:
     82             return new GoogLeNet(4);
     83         }
     84 
     85         return null;
     86     }
     87 }
     88 
     89