Commit f1347bea authored by Cianciosa, Mark's avatar Cianciosa, Mark
Browse files

Enable JIT compulation for the CPU.

parent f24a28ab
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -66,11 +66,6 @@ target_link_libraries (gpu_lib
                       $<$<BOOL:${USE_METAL}>:metal_lib>
                       $<$<BOOL:${USE_CUDA}>:cuda_lib>
)
target_compile_definitions (gpu_lib
                            INTERFACE
                            $<$<BOOL:${USE_METAL}>:USE_GPU>
                            $<$<BOOL:${USE_CUDA}>:USE_GPU>
)

#-------------------------------------------------------------------------------
#  Sanitizer options
+5 −9
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
#include <thread>
#include <random>

#include "../graph_framework/cpu_backend.hpp"
#include "../graph_framework/backend.hpp"
#include "../graph_framework/solver.hpp"
#include "../graph_framework/timing.hpp"

@@ -17,7 +17,7 @@ void write_time(const std::string &name, const std::chrono::nanoseconds time);
//------------------------------------------------------------------------------
///  @brief Main program of the driver.
///
///  @param[in] t Current Time.
///  @params[in] t Current Time.
//------------------------------------------------------------------------------
template<typename base>
static base solution(const base t) {
@@ -27,8 +27,8 @@ static base solution(const base t) {
//------------------------------------------------------------------------------
///  @brief Main program of the driver.
///
///  @param[in] argc Number of commandline arguments.
///  @param[in] argv Array of commandline arguments.
///  @params[in] argc Number of commandline arguments.
///  @params[in] argv Array of commandline arguments.
//------------------------------------------------------------------------------
int main(int argc, const char * argv[]) {
    START_GPU
@@ -45,17 +45,13 @@ int main(int argc, const char * argv[]) {
    const size_t num_rays = 1000000;

    std::vector<std::thread> threads(0);
#if USE_GPU
    if constexpr (jit::can_jit<base> ()) {
    if constexpr (jit::use_gpu<base> ()) {
        threads.resize(1);
    } else {
#endif
        threads.resize(std::max(std::min(std::thread::hardware_concurrency(),
                                         static_cast<unsigned int> (num_rays)),
                                static_cast<unsigned int> (1)));
#if USE_GPU
    }
#endif

    for (size_t i = 0, ie = threads.size(); i < ie; i++) {
        threads[i] = std::thread([num_times, num_rays] (const size_t thread_number,
+11 −5
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
		C713426A2947F39400672AD4 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
		C721EA9A2833FF7800EAFB2D /* equilibrium.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C721EA992833FF7800EAFB2D /* equilibrium.hpp */; };
		C79141B622DAAD0C00E0BA0D /* xrays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C79141B522DAAD0C00E0BA0D /* xrays.cpp */; };
		C7B677D929E45C9500D3ADC6 /* backend.hpp in Headers */ = {isa = PBXBuildFile; fileRef = C7B677D829E45C9500D3ADC6 /* backend.hpp */; };
		C7E5644528A2A1AA000F31A2 /* backend_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C7931E7328074F540033B488 /* backend_test.cpp */; };
		C7E5645128A2A1DD000F31A2 /* dispersion_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C7931E6B28073BCA0033B488 /* dispersion_test.cpp */; };
		C7E5645D28A2A21D000F31A2 /* solver_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C7931E6C28073BCA0033B488 /* solver_test.cpp */; };
@@ -128,13 +129,12 @@
		C721EA992833FF7800EAFB2D /* equilibrium.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = equilibrium.hpp; sourceTree = "<group>"; };
		C723210222DC0D0A006BBF13 /* arithmetic.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = arithmetic.hpp; sourceTree = "<group>"; };
		C725CD792840088000D0EDE2 /* physics_test.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = physics_test.cpp; sourceTree = "<group>"; };
		C72D922D280489D10051BAF2 /* backend_protocall.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = backend_protocall.hpp; sourceTree = "<group>"; };
		C72D922E28048D720051BAF2 /* cpu_backend.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = cpu_backend.hpp; sourceTree = "<group>"; };
		C77E6DF522DD64E700469621 /* trigonometry.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = trigonometry.hpp; sourceTree = "<group>"; };
		C79141A622DA9BF200E0BA0D /* libgraph_framework.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libgraph_framework.a; sourceTree = BUILT_PRODUCTS_DIR; };
		C79141AE22DA9C3000E0BA0D /* node.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = node.hpp; sourceTree = "<group>"; };
		C79141B322DAAD0C00E0BA0D /* graph_driver */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = graph_driver; sourceTree = BUILT_PRODUCTS_DIR; };
		C79141B522DAAD0C00E0BA0D /* xrays.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = xrays.cpp; sourceTree = "<group>"; };
		C7922EEB29E0ABDF000BB9C7 /* workflow.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = workflow.hpp; sourceTree = "<group>"; };
		C7931E6A28073BCA0033B488 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
		C7931E6B28073BCA0033B488 /* dispersion_test.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = dispersion_test.cpp; sourceTree = "<group>"; };
		C7931E6C28073BCA0033B488 /* solver_test.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = solver_test.cpp; sourceTree = "<group>"; };
@@ -145,6 +145,8 @@
		C7931E7128073BF30033B488 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
		C7931E7228073BFC0033B488 /* CMakeLists.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
		C7931E7328074F540033B488 /* backend_test.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = backend_test.cpp; sourceTree = "<group>"; };
		C7B677D829E45C9500D3ADC6 /* backend.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = backend.hpp; sourceTree = "<group>"; };
		C7B677DA29E464AE00D3ADC6 /* cpu_context.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = cpu_context.hpp; sourceTree = "<group>"; };
		C7CEA0042948D02A00F61D09 /* timing.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = timing.hpp; sourceTree = "<group>"; };
		C7CEA0052948EB0F00F61D09 /* cuda_context.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = cuda_context.hpp; sourceTree = "<group>"; };
		C7E5643E28A2A16F000F31A2 /* backend_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = backend_test; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -286,18 +288,19 @@
			children = (
				C7931E7028073BE70033B488 /* CMakeLists.txt */,
				C79141AE22DA9C3000E0BA0D /* node.hpp */,
				C7922EEB29E0ABDF000BB9C7 /* workflow.hpp */,
				C71C1FF727F61DFA006997C2 /* math.hpp */,
				C71C1FF827F621E7006997C2 /* vector.hpp */,
				C723210222DC0D0A006BBF13 /* arithmetic.hpp */,
				C77E6DF522DD64E700469621 /* trigonometry.hpp */,
				C71C1FF527F5379D006997C2 /* dispersion.hpp */,
				C71C1FF627F5F5A8006997C2 /* solver.hpp */,
				C72D922D280489D10051BAF2 /* backend_protocall.hpp */,
				C72D922E28048D720051BAF2 /* cpu_backend.hpp */,
				C7B677D829E45C9500D3ADC6 /* backend.hpp */,
				C721EA992833FF7800EAFB2D /* equilibrium.hpp */,
				C713425B29413F0500672AD4 /* jit.hpp */,
				C713425C2942665300672AD4 /* register.hpp */,
				C71342652947D57900672AD4 /* metal_context.hpp */,
				C7B677DA29E464AE00D3ADC6 /* cpu_context.hpp */,
				C7CEA0052948EB0F00F61D09 /* cuda_context.hpp */,
				C7CEA0042948D02A00F61D09 /* timing.hpp */,
			);
@@ -338,6 +341,7 @@
			buildActionMask = 2147483647;
			files = (
				C71342662947D57900672AD4 /* metal_context.hpp in Headers */,
				C7B677D929E45C9500D3ADC6 /* backend.hpp in Headers */,
				C721EA9A2833FF7800EAFB2D /* equilibrium.hpp in Headers */,
			);
			runOnlyForDeploymentPostprocessing = 0;
@@ -538,7 +542,7 @@
		C791419E22DA9BF200E0BA0D /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 1410;
				LastUpgradeCheck = 1420;
				ORGANIZATIONNAME = "Cianciosa, Mark R.";
				TargetAttributes = {
					C79141A522DA9BF200E0BA0D = {
@@ -1068,6 +1072,7 @@
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
				CODE_SIGN_IDENTITY = "-";
				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
				CODE_SIGN_STYLE = Automatic;
				GCC_PREPROCESSOR_DEFINITIONS = (
@@ -1083,6 +1088,7 @@
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
				CODE_SIGN_IDENTITY = "-";
				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
				CODE_SIGN_STYLE = Automatic;
				MACOSX_DEPLOYMENT_TARGET = 12.6;
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "1410"
   LastUpgradeVersion = "1420"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
+1 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "1410"
   LastUpgradeVersion = "1420"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
Loading