Change the value of scalar, and specify in a #define
This commit is contained in:
parent
fe41771bd4
commit
5ae613519d
7
Stream.h
7
Stream.h
@ -10,6 +10,12 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Array values
|
||||
#define startA (0.1)
|
||||
#define startB (0.2)
|
||||
#define startC (0.0)
|
||||
#define startScalar (0.4)
|
||||
|
||||
template <class T>
|
||||
class Stream
|
||||
{
|
||||
@ -35,3 +41,4 @@ class Stream
|
||||
void listDevices(void);
|
||||
std::string getDeviceName(const int);
|
||||
std::string getDeviceDriver(const int);
|
||||
|
||||
|
||||
15
main.cpp
15
main.cpp
@ -44,7 +44,6 @@ unsigned int num_times = 100;
|
||||
unsigned int deviceIndex = 0;
|
||||
bool use_float = false;
|
||||
|
||||
|
||||
template <typename T>
|
||||
void check_solution(const unsigned int ntimes, std::vector<T>& a, std::vector<T>& b, std::vector<T>& c);
|
||||
|
||||
@ -85,9 +84,9 @@ void run()
|
||||
std::cout << "Precision: double" << std::endl;
|
||||
|
||||
// Create host vectors
|
||||
std::vector<T> a(ARRAY_SIZE, 0.1);
|
||||
std::vector<T> b(ARRAY_SIZE, 0.2);
|
||||
std::vector<T> c(ARRAY_SIZE, 0.0);
|
||||
std::vector<T> a(ARRAY_SIZE, startA);
|
||||
std::vector<T> b(ARRAY_SIZE, startB);
|
||||
std::vector<T> c(ARRAY_SIZE, startC);
|
||||
std::streamsize ss = std::cout.precision();
|
||||
std::cout << std::setprecision(1) << std::fixed
|
||||
<< "Array size: " << ARRAY_SIZE*sizeof(T)*1.0E-6 << " MB"
|
||||
@ -222,11 +221,11 @@ template <typename T>
|
||||
void check_solution(const unsigned int ntimes, std::vector<T>& a, std::vector<T>& b, std::vector<T>& c)
|
||||
{
|
||||
// Generate correct solution
|
||||
T goldA = 0.1;
|
||||
T goldB = 0.2;
|
||||
T goldC = 0.0;
|
||||
T goldA = startA;
|
||||
T goldB = startB;
|
||||
T goldC = startC;
|
||||
|
||||
const T scalar = 0.3;
|
||||
const T scalar = startScalar;
|
||||
|
||||
for (unsigned int i = 0; i < ntimes; i++)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user