Browse Source

Show devices even only one is avaliable

Roman Shkarin 9 years ago
parent
commit
30e017595c
6 changed files with 11 additions and 15 deletions
  1. 1 1
      benchmark.c
  2. 4 2
      cpu_fft.c
  3. 3 5
      cuda_fft.c
  4. 2 4
      opencl_fft.c
  5. 0 3
      utilities.c
  6. 1 0
      utilities.h

+ 1 - 1
benchmark.c

@@ -253,7 +253,7 @@ main (int argc, char **argv)
 
 #ifdef HAVE_CUDA_FFT
     if (with_cuda_fft) {
-        write_time_entries_in_file (cuda_time_entries, 1, N_DIMS, only_time, new_line, fp);
+        write_time_entries_in_file (cuda_time_entries, cuda_n_devices, N_DIMS, only_time, new_line, fp);
     }
 #endif
 

+ 4 - 2
cpu_fft.c

@@ -7,11 +7,13 @@ void loop_data_fftw (OutputType outputType, TimeEntry *time_entry)
 {
     
     Timer *timer;
-
     timer = timer_new ();
 
-    time_entry->lib_name = "FFTW";
     time_entry->dim_entries = (DimEntry *)malloc(N_DIMS * sizeof(DimEntry));
+    time_entry->lib_name = "CPU (FFTW)";
+
+    printf ("Device: %s\n", time_entry->lib_name);
+    fflush (stdout);
 
     for (int k = 0; k < N_DIMS; k++) {
         int dim = DIMS[k];

+ 3 - 5
cuda_fft.c

@@ -21,11 +21,9 @@ void loop_data_cuda (const char *vendor,
 
         time_entries[j].dim_entries = (DimEntry *)malloc(N_DIMS * sizeof(DimEntry));
 
-        if (n_devices > 1) {
-            printf ("Device: %s\n", time_entries[j].lib_name);
-            fflush (stdout);
-        }
-
+        printf ("Device: %s\n", time_entries[j].lib_name);
+        fflush (stdout);
+        
         cudaThreadExit();
         cudaSetDevice(j);
 

+ 2 - 4
opencl_fft.c

@@ -46,10 +46,8 @@ void loop_data_opencl (const char *vendor,
 
         time_entries[j].dim_entries = (DimEntry *)malloc(N_DIMS * sizeof(DimEntry));
 
-        if (n_devices > 1) {
-            printf ("Device: %s\n", time_entries[j].lib_name);
-            fflush (stdout);
-        }
+        printf ("Device: %s\n", time_entries[j].lib_name);
+        fflush (stdout);
 
         for (int k = 0; k < N_DIMS; k++) {
             int dim = DIMS[k];

+ 0 - 3
utilities.c

@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-
 #include "utilities.h"
 
 void write_headers_in_file (int n_dims, int only_time, FILE *fp)

+ 1 - 0
utilities.h

@@ -2,6 +2,7 @@
 #define UTILITIES_H
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
 #include <getopt.h>