Daniel Gyulai 3 years ago
parent
commit
8f51a89375
  1. 73
      Common/Tests.h
  2. 10
      Primitives.sln
  3. 2
      Primitives/Compact.cpp
  4. 2
      Primitives/ExclusiveScan.cpp
  5. 2
      Primitives/Histogram.cpp
  6. 76
      Primitives/PrimitiveTests.h
  7. 2
      Primitives/Primitives.cpp
  8. 3
      Primitives/Primitives.vcxproj
  9. 5
      Primitives/Primitives.vcxproj.filters
  10. 2
      Primitives/ReduceAdd.cpp
  11. 2
      Primitives/Square.cpp

73
Common/Tests.h

@ -20,76 +20,3 @@ public:
virtual std::string description() = 0;
};
class Square : public TestCase {
private:
std::vector<float> gpuResult;
std::vector<float> sourceData;
std::vector<float> cpuResult;
public:
Square();
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class Histogram : public TestCase {
private:
bool global;
size_t valueSet;
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
public:
Histogram(bool _global, int _valueSet, int _data_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class ReduceAdd : public TestCase {
private:
std::vector<float> gpuResult;
std::vector<float> sourceData;
float cpuResult;
public:
ReduceAdd(size_t max_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class ExclusiveScan : public TestCase {
private:
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
public:
ExclusiveScan(size_t max_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class Compact : public TestCase {
private:
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
int limit;
int result_size;
public:
Compact(size_t _data_size);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
void collect_results(cl::CommandQueue* queue);
bool validate_results();
std::string description();
};

10
Primitives.sln

@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Linear", "Linear\Linear.vcx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Common", "Common\Common.vcxproj", "{F66311CB-C60D-43DE-890C-7E6D8179CA44}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MonteCarlo", "MonteCarlo\MonteCarlo.vcxproj", "{4B53AC9F-C842-4E17-93EB-1362CFD08104}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -47,6 +49,14 @@ Global
{F66311CB-C60D-43DE-890C-7E6D8179CA44}.Release|Win32.Build.0 = Release|Win32
{F66311CB-C60D-43DE-890C-7E6D8179CA44}.Release|x64.ActiveCfg = Release|x64
{F66311CB-C60D-43DE-890C-7E6D8179CA44}.Release|x64.Build.0 = Release|x64
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Debug|Win32.ActiveCfg = Debug|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Debug|Win32.Build.0 = Debug|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Debug|x64.ActiveCfg = Debug|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Debug|x64.Build.0 = Debug|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Release|Win32.ActiveCfg = Release|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Release|Win32.Build.0 = Release|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Release|x64.ActiveCfg = Release|Win32
{4B53AC9F-C842-4E17-93EB-1362CFD08104}.Release|x64.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

2
Primitives/Compact.cpp

@ -1,6 +1,6 @@
#include <iostream>
#include "Common.h"
#include "Tests.h"
#include "PrimitiveTests.h"
#include <random>
Compact::Compact(size_t _data_size)

2
Primitives/ExclusiveScan.cpp

@ -1,6 +1,6 @@
#include <iostream>
#include "Common.h"
#include "Tests.h"
#include "PrimitiveTests.h"
#include <random>
ExclusiveScan::ExclusiveScan(size_t max_size)

2
Primitives/Histogram.cpp

@ -1,6 +1,6 @@
#include <iostream>
#include "Common.h"
#include "Tests.h"
#include "PrimitiveTests.h"
#include <random>
Histogram::Histogram(bool _global, int _valueSet, int _data_size)

76
Primitives/PrimitiveTests.h

@ -0,0 +1,76 @@
#pragma once
#include "Tests.h"
class Square : public TestCase {
private:
std::vector<float> gpuResult;
std::vector<float> sourceData;
std::vector<float> cpuResult;
public:
Square();
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class Histogram : public TestCase {
private:
bool global;
size_t valueSet;
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
public:
Histogram(bool _global, int _valueSet, int _data_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class ReduceAdd : public TestCase {
private:
std::vector<float> gpuResult;
std::vector<float> sourceData;
float cpuResult;
public:
ReduceAdd(size_t max_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class ExclusiveScan : public TestCase {
private:
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
public:
ExclusiveScan(size_t max_size);
void collect_results(cl::CommandQueue* queue);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
bool validate_results();
std::string description();
};
class Compact : public TestCase {
private:
std::vector<int> gpuResult;
std::vector<int> sourceData;
std::vector<int> cpuResult;
int limit;
int result_size;
public:
Compact(size_t _data_size);
void gpu_compute(cl::Context* context, cl::CommandQueue* queue, cl::Program* program, cl::Event* Event);
void cpu_compute();
void collect_results(cl::CommandQueue* queue);
bool validate_results();
std::string description();
};

2
Primitives/Primitives.cpp

@ -5,7 +5,7 @@
#include <iostream>
#include "Common.h"
#include "OpenCLHandler.h"
#include "Tests.h"
#include "PrimitiveTests.h"
// OpenCL C API
#include <CL/opencl.h>

3
Primitives/Primitives.vcxproj

@ -86,6 +86,9 @@
<Project>{f66311cb-c60d-43de-890c-7e6d8179ca44}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClInclude Include="PrimitiveTests.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

5
Primitives/Primitives.vcxproj.filters

@ -42,4 +42,9 @@
<Filter>Kernels</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="PrimitiveTests.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

2
Primitives/ReduceAdd.cpp

@ -1,7 +1,7 @@
#include <iostream>
#include <iomanip>
#include "Common.h"
#include "Tests.h"
#include "PrimitiveTests.h"
#include <random>
#include <stdlib.h>

2
Primitives/Square.cpp

@ -1,6 +1,6 @@
#include <iostream>
#include "Common.h"
#include "Tests.h"
#include "PrimitiveTests.h"
#include <random>

Loading…
Cancel
Save