Commit fd2787f9 authored by cianciosa's avatar cianciosa
Browse files

Add benckmark tool.

parent a303c9e0
Loading
Loading
Loading
Loading
+16 −22
Original line number Diff line number Diff line
@@ -12,27 +12,25 @@
template<typename T, size_t NUM_TIMES, size_t SUB_STEPS, size_t NUM_RAYS>
void bench_runner() {
    if constexpr (std::is_same<T, float>::value) {
        std::cout << "Float ";
        std::cout << "Float --------------------------------------------------------------------------" << std::endl;
    } else if constexpr (std::is_same<T, double>::value) {
        std::cout << "Double ";
        std::cout << "Double -------------------------------------------------------------------------" << std::endl;
    } else if constexpr (std::is_same<T, std::complex<float>>::value) {
        std::cout << "Complex Float ";
        std::cout << "Complex Float ------------------------------------------------------------------" << std::endl;
    } else {
        std::cout << "Complex Double ";
        std::cout << "Complex Double -----------------------------------------------------------------" << std::endl;
    }

    std::cout << "--------------------------------------------------------------------------------" << std::endl;

    const size_t num_steps = NUM_TIMES/SUB_STEPS;

    std::vector<std::thread> threads(std::max(std::min(static_cast<unsigned int> (jit::context<T, false>::max_concurrency()),
                                                       static_cast<unsigned int> (NUM_RAYS)),
                                              static_cast<unsigned int> (1)));

    std::vector<timeing::measure_diagnostic> timers;
    timeing::measure_diagnostic_threaded timing;

    for (size_t i = 0, ie = threads.size(); i < ie; i++) {
        threads[i] = std::thread([&timers] (const size_t thread_number,
        threads[i] = std::thread([&timing] (const size_t thread_number,
                                            const size_t num_threads) -> void {
            const size_t local_num_rays = NUM_RAYS/num_threads
                                        + std::min(thread_number, NUM_RAYS%num_threads);
@@ -73,28 +71,24 @@ void bench_runner() {
            solve.init(kx);
            solve.compile();

            std::ostringstream step_label;
            step_label << "Step Time thread " << thread_number;
            timers.emplace_back(step_label.str());
            timing.start_time(thread_number);
            for (size_t j = 0; j < num_steps; j++) {
                for (size_t k = 0; k < SUB_STEPS; k++) {
                    solve.step();
                }
            }
            solve.sync_host();
            timers[thread_number].stop();
            timing.end_time(thread_number);
        }, i, threads.size());
    }
    
    for (std::thread &t : threads) {
        t.join();
    }
    timing.print();

    for (auto &time : timers) {
        time.print();
    }

    std::cout << "--------------------------------------------------------------------------------" << std::endl;
    std::cout << "--------------------------------------------------------------------------------"
              << std::endl << std::endl;
}

//------------------------------------------------------------------------------
@@ -106,10 +100,10 @@ void bench_runner() {
int main(int argc, const char * argv[]) {
    START_GPU
    
    bench_runner<float,                100000, 10, 100000> ();
    bench_runner<double,               100000, 10, 100000> ();
    bench_runner<std::complex<float>,  100000, 10, 100000> ();
    bench_runner<std::complex<double>, 100000, 10, 100000> ();
    bench_runner<float,                1000, 10, 100000> ();
    bench_runner<double,               1000, 10, 100000> ();
    bench_runner<std::complex<float>,  1000, 10, 100000> ();
    bench_runner<std::complex<double>, 1000, 10, 100000> ();

    END_GPU
}
+4 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
const bool print = false;
const bool write_step = true;
const bool print_expressions = false;
const bool verbose = true;

//------------------------------------------------------------------------------
///  @brief Main program of the driver.
@@ -23,6 +24,8 @@ const bool print_expressions = false;
int main(int argc, const char * argv[]) {
    START_GPU

    jit::verbose = verbose;

    typedef float base;
    //typedef double base;
    //typedef std::complex<float> base;
@@ -30,7 +33,7 @@ int main(int argc, const char * argv[]) {
    //constexpr bool use_safe_math = true;
    constexpr bool use_safe_math = false;

    timeing::measure_diagnostic total("Total Time");
    const timeing::measure_diagnostic total("Total Time");

    const size_t num_times = 100000;
    const size_t sub_steps = 10;
@@ -182,7 +185,6 @@ int main(int argc, const char * argv[]) {
    }

    std::cout << std::endl << "Timing:" << std::endl;
    total.stop();
    total.print();

    END_GPU
+283 −2
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
		C73BBE7E29F816E60027BB7F /* piecewise_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C73BBE7D29F816E60027BB7F /* piecewise_test.cpp */; };
		C73BBE8229F820810027BB7F /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
		C73E2A7A2A4A216400BED03A /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
		C74DF4602AA8BD1900319113 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
		C79141B622DAAD0C00E0BA0D /* xrays.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C79141B522DAAD0C00E0BA0D /* xrays.cpp */; };
		C7D371132A0595A40074676E /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
		C7E5644528A2A1AA000F31A2 /* backend_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C7931E7328074F540033B488 /* backend_test.cpp */; };
@@ -46,6 +47,107 @@
		C7FA0E0B29590F9F00A31E4D /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C71342682947F36100672AD4 /* Metal.framework */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
		C74DF4612AA8BD2600319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4632AA8BD3400319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4652AA8BD3900319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4672AA8BD3E00319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4692AA8BD4200319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF46B2AA8BD4600319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF46D2AA8BD4B00319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF46F2AA8BD4F00319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4712AA8BD5300319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4732AA8BD5700319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4752AA8BD5B00319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4772AA8BD5F00319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF4792AA8BD6200319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
		C74DF47B2AA8BD6600319113 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = C791419E22DA9BF200E0BA0D /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = C79141A522DA9BF200E0BA0D;
			remoteInfo = graph_framework;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
		C736902F2A38C498001733B0 /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
@@ -74,6 +176,15 @@
			);
			runOnlyForDeploymentPostprocessing = 1;
		};
		C74DF4552AA8BC7300319113 /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = /usr/share/man/man1/;
			dstSubfolderSpec = 0;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 1;
		};
		C79141B122DAAD0C00E0BA0D /* CopyFiles */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
@@ -188,7 +299,9 @@
		C73BBE7B29F816E50027BB7F /* piecewise_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = piecewise_test; sourceTree = BUILT_PRODUCTS_DIR; };
		C73BBE7D29F816E60027BB7F /* piecewise_test.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = piecewise_test.cpp; sourceTree = "<group>"; };
		C73BBE9629F8669F0027BB7F /* newton.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = newton.hpp; sourceTree = "<group>"; };
		C7616FBC2AA7944400A831DE /* graph_benchmark */ = {isa = PBXFileReference; lastKnownFileType = folder; path = graph_benchmark; sourceTree = "<group>"; };
		C74DF4572AA8BC7300319113 /* graph_benchmark */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = graph_benchmark; sourceTree = BUILT_PRODUCTS_DIR; };
		C74DF4592AA8BC7300319113 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
		C74DF45F2AA8BCE600319113 /* graph_benchmark */ = {isa = PBXFileReference; lastKnownFileType = folder; path = graph_benchmark; 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>"; };
@@ -246,6 +359,14 @@
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C74DF4542AA8BC7300319113 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				C74DF4602AA8BD1900319113 /* Metal.framework in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C79141A422DA9BF200E0BA0D /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
@@ -346,6 +467,14 @@
			path = cmake;
			sourceTree = "<group>";
		};
		C74DF4582AA8BC7300319113 /* graph_benchmark */ = {
			isa = PBXGroup;
			children = (
				C74DF4592AA8BC7300319113 /* main.cpp */,
			);
			path = graph_benchmark;
			sourceTree = "<group>";
		};
		C791419D22DA9BF200E0BA0D = {
			isa = PBXGroup;
			children = (
@@ -353,8 +482,9 @@
				C79141AD22DA9C0600E0BA0D /* graph_framework */,
				C7931E6928073BCA0033B488 /* graph_tests */,
				C79141B422DAAD0C00E0BA0D /* graph_driver */,
				C7616FBC2AA7944400A831DE /* graph_benchmark */,
				C74DF45F2AA8BCE600319113 /* graph_benchmark */,
				C717CB8C2A02E361008FBDD8 /* cmake */,
				C74DF4582AA8BC7300319113 /* graph_benchmark */,
				C79141A722DA9BF200E0BA0D /* Products */,
				C71342672947F36100672AD4 /* Frameworks */,
			);
@@ -377,6 +507,7 @@
				C73BBE6F29F72BC50027BB7F /* trigonometry_test */,
				C73BBE7B29F816E50027BB7F /* piecewise_test */,
				C73690312A38C498001733B0 /* erfi_test */,
				C74DF4572AA8BC7300319113 /* graph_benchmark */,
			);
			name = Products;
			sourceTree = "<group>";
@@ -481,6 +612,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF47C2AA8BD6600319113 /* PBXTargetDependency */,
			);
			name = erfi_test;
			productName = erfi_test;
@@ -498,6 +630,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4782AA8BD5F00319113 /* PBXTargetDependency */,
			);
			name = trigonometry_test;
			productName = trigonometry_test;
@@ -515,12 +648,31 @@
			buildRules = (
			);
			dependencies = (
				C74DF47A2AA8BD6200319113 /* PBXTargetDependency */,
			);
			name = piecewise_test;
			productName = piecewise_test;
			productReference = C73BBE7B29F816E50027BB7F /* piecewise_test */;
			productType = "com.apple.product-type.tool";
		};
		C74DF4562AA8BC7300319113 /* graph_benchmark */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = C74DF45D2AA8BC7300319113 /* Build configuration list for PBXNativeTarget "graph_benchmark" */;
			buildPhases = (
				C74DF4532AA8BC7300319113 /* Sources */,
				C74DF4542AA8BC7300319113 /* Frameworks */,
				C74DF4552AA8BC7300319113 /* CopyFiles */,
			);
			buildRules = (
			);
			dependencies = (
				C74DF4622AA8BD2600319113 /* PBXTargetDependency */,
			);
			name = graph_benchmark;
			productName = graph_benchmark;
			productReference = C74DF4572AA8BC7300319113 /* graph_benchmark */;
			productType = "com.apple.product-type.tool";
		};
		C79141A522DA9BF200E0BA0D /* graph_framework */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = C79141AA22DA9BF200E0BA0D /* Build configuration list for PBXNativeTarget "graph_framework" */;
@@ -549,6 +701,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4642AA8BD3400319113 /* PBXTargetDependency */,
			);
			name = graph_driver;
			productName = graph_driver;
@@ -566,6 +719,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4662AA8BD3900319113 /* PBXTargetDependency */,
			);
			name = backend_test;
			productName = graph_tests;
@@ -583,6 +737,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4682AA8BD3E00319113 /* PBXTargetDependency */,
			);
			name = dispersion_test;
			productName = graph_tests;
@@ -600,6 +755,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF46A2AA8BD4200319113 /* PBXTargetDependency */,
			);
			name = solver_test;
			productName = graph_tests;
@@ -617,6 +773,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF46C2AA8BD4600319113 /* PBXTargetDependency */,
			);
			name = arithmetic_test;
			productName = graph_tests;
@@ -634,6 +791,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF46E2AA8BD4B00319113 /* PBXTargetDependency */,
			);
			name = math_test;
			productName = graph_tests;
@@ -651,6 +809,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4702AA8BD4F00319113 /* PBXTargetDependency */,
			);
			name = node_test;
			productName = graph_tests;
@@ -668,6 +827,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4722AA8BD5300319113 /* PBXTargetDependency */,
			);
			name = vector_test;
			productName = graph_tests;
@@ -685,6 +845,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4742AA8BD5700319113 /* PBXTargetDependency */,
			);
			name = physics_test;
			productName = graph_tests;
@@ -702,6 +863,7 @@
			buildRules = (
			);
			dependencies = (
				C74DF4762AA8BD5B00319113 /* PBXTargetDependency */,
			);
			name = jit_test;
			productName = jit_test;
@@ -727,6 +889,9 @@
					C73BBE7A29F816E50027BB7F = {
						CreatedOnToolsVersion = 14.3;
					};
					C74DF4562AA8BC7300319113 = {
						CreatedOnToolsVersion = 14.3.1;
					};
					C79141A522DA9BF200E0BA0D = {
						CreatedOnToolsVersion = 10.2.1;
					};
@@ -789,6 +954,7 @@
				C73BBE6E29F72BC50027BB7F /* trigonometry_test */,
				C73BBE7A29F816E50027BB7F /* piecewise_test */,
				C73690302A38C498001733B0 /* erfi_test */,
				C74DF4562AA8BC7300319113 /* graph_benchmark */,
			);
		};
/* End PBXProject section */
@@ -818,6 +984,13 @@
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C74DF4532AA8BC7300319113 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		C79141A322DA9BF200E0BA0D /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
@@ -907,6 +1080,79 @@
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
		C74DF4622AA8BD2600319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4612AA8BD2600319113 /* PBXContainerItemProxy */;
		};
		C74DF4642AA8BD3400319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4632AA8BD3400319113 /* PBXContainerItemProxy */;
		};
		C74DF4662AA8BD3900319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4652AA8BD3900319113 /* PBXContainerItemProxy */;
		};
		C74DF4682AA8BD3E00319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4672AA8BD3E00319113 /* PBXContainerItemProxy */;
		};
		C74DF46A2AA8BD4200319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4692AA8BD4200319113 /* PBXContainerItemProxy */;
		};
		C74DF46C2AA8BD4600319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF46B2AA8BD4600319113 /* PBXContainerItemProxy */;
		};
		C74DF46E2AA8BD4B00319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF46D2AA8BD4B00319113 /* PBXContainerItemProxy */;
		};
		C74DF4702AA8BD4F00319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF46F2AA8BD4F00319113 /* PBXContainerItemProxy */;
		};
		C74DF4722AA8BD5300319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4712AA8BD5300319113 /* PBXContainerItemProxy */;
		};
		C74DF4742AA8BD5700319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4732AA8BD5700319113 /* PBXContainerItemProxy */;
		};
		C74DF4762AA8BD5B00319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4752AA8BD5B00319113 /* PBXContainerItemProxy */;
		};
		C74DF4782AA8BD5F00319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4772AA8BD5F00319113 /* PBXContainerItemProxy */;
		};
		C74DF47A2AA8BD6200319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF4792AA8BD6200319113 /* PBXContainerItemProxy */;
		};
		C74DF47C2AA8BD6600319113 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = C79141A522DA9BF200E0BA0D /* graph_framework */;
			targetProxy = C74DF47B2AA8BD6600319113 /* PBXContainerItemProxy */;
		};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
		C73690362A38C498001733B0 /* Debug */ = {
			isa = XCBuildConfiguration;
@@ -1004,6 +1250,32 @@
			};
			name = Release;
		};
		C74DF45B2AA8BC7300319113 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
				CODE_SIGN_STYLE = Automatic;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				MACOSX_DEPLOYMENT_TARGET = 13.3;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		C74DF45C2AA8BC7300319113 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
				CODE_SIGN_STYLE = Automatic;
				MACOSX_DEPLOYMENT_TARGET = 13.3;
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
		C79141A822DA9BF200E0BA0D /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
@@ -1492,6 +1764,15 @@
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		C74DF45D2AA8BC7300319113 /* Build configuration list for PBXNativeTarget "graph_benchmark" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				C74DF45B2AA8BC7300319113 /* Debug */,
				C74DF45C2AA8BC7300319113 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		C79141A122DA9BF200E0BA0D /* Build configuration list for PBXProject "graph_framework" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
+18 −5
Original line number Diff line number Diff line
@@ -43,6 +43,13 @@ namespace gpu {
            return std::thread::hardware_concurrency();
        }

//------------------------------------------------------------------------------
///  @brief Device discription.
//------------------------------------------------------------------------------
        static std::string device_type() {
            return "CPU";
        }

//------------------------------------------------------------------------------
///  @brief Construct a cpu context.
///
@@ -106,8 +113,10 @@ namespace gpu {
#endif
            temp_stream << filename << " -o " << library_name;

            if (jit::verbose) {
                std::cout << "CPU info." << std::endl;
                std::cout << "  Command Line    : " << temp_stream.str() << std::endl;
            }
            int error = system(temp_stream.str().c_str());
            if (error) {
                std::cerr << "Failed to compile cpu kernel. Check source code in "
@@ -130,9 +139,11 @@ namespace gpu {
                exit(1);
            }

            if (jit::verbose) {
                std::cout << "  Library name    : " << library_name << std::endl;
                std::cout << "  Library handle  : " << reinterpret_cast<size_t> (lib_handle) << std::endl;
            }
        }

//------------------------------------------------------------------------------
///  @brief Create a kernel calling function.
@@ -173,7 +184,9 @@ namespace gpu {
                buffers[jit::to_string('o', output.get())] = kernel_arguments[output.get()].data();
            }

            if (jit::verbose) {
                std::cout << "  Function pointer: " << reinterpret_cast<size_t> (kernel) << std::endl;
            }

            return [kernel, buffers] () mutable {
                ((void (*)(std::map<std::string, T *> &))kernel)(buffers);
+29 −10

File changed.

Preview size limit exceeded, changes collapsed.

Loading