Loading graph_driver/xrays.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ static base solution(const base t) { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU //typedef std::complex<double> base; //typedef double base; typedef float base; Loading Loading @@ -146,4 +148,6 @@ int main(int argc, const char * argv[]) { std::cout << std::endl << "Timing:" << std::endl; total.stop(); END_GPU } graph_framework/jit.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,14 @@ #define GPU_CONTEXT gpu::hip_context #endif #ifdef USE_METAL #define START_GPU @autoreleasepool { #define END_GPU } #else #define START_GPU #define END_GPU #endif namespace jit { //------------------------------------------------------------------------------ /// @brief Tests if the backend can be jit'ed. Loading graph_framework/metal_context.hpp +53 −57 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ namespace gpu { graph::output_nodes<BACKEND> outputs, const size_t num_rays, const bool add_reduction=false) { @autoreleasepool { NSError *error; library = [device newLibraryWithSource:[NSString stringWithCString:kernel_source.c_str() encoding:NSUTF8StringEncoding] Loading Loading @@ -122,7 +121,6 @@ namespace gpu { std::cout << " Number of groups : " << thread_groups << std::endl; std::cout << " Total problem size : " << threads_per_group*thread_groups << std::endl; } } //------------------------------------------------------------------------------ /// @brief Create a max compute pipeline. Loading Loading @@ -163,7 +161,6 @@ namespace gpu { /// the job. This method is asyncronus. //------------------------------------------------------------------------------ void run() { @autoreleasepool { command_buffer = [queue commandBuffer]; id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoderWithDispatchType:MTLDispatchTypeSerial]; Loading @@ -178,7 +175,6 @@ namespace gpu { [command_buffer commit]; } } //------------------------------------------------------------------------------ /// @brief Compute the max reduction. Loading graph_tests/dispersion_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ template<typename BACKEND> void run_tests(const typename BACKEND::base tolarance /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU #ifdef USE_REDUCE #ifdef USE_CUDA run_tests<backend::cpu<float>> (3.2E-14); Loading @@ -126,4 +127,5 @@ int main(int argc, const char * argv[]) { run_tests<backend::cpu<std::complex<float>>> (2.0E-14); #endif run_tests<backend::cpu<std::complex<double>>> (1.0E-30); END_GPU } graph_tests/jit_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -397,8 +397,10 @@ template<typename BASE> void run_tests() { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU run_tests<float> (); run_tests<double> (); run_tests<std::complex<float>> (); run_tests<std::complex<double>> (); END_GPU } Loading
graph_driver/xrays.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ static base solution(const base t) { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU //typedef std::complex<double> base; //typedef double base; typedef float base; Loading Loading @@ -146,4 +148,6 @@ int main(int argc, const char * argv[]) { std::cout << std::endl << "Timing:" << std::endl; total.stop(); END_GPU }
graph_framework/jit.hpp +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,14 @@ #define GPU_CONTEXT gpu::hip_context #endif #ifdef USE_METAL #define START_GPU @autoreleasepool { #define END_GPU } #else #define START_GPU #define END_GPU #endif namespace jit { //------------------------------------------------------------------------------ /// @brief Tests if the backend can be jit'ed. Loading
graph_framework/metal_context.hpp +53 −57 Original line number Diff line number Diff line Loading @@ -71,7 +71,6 @@ namespace gpu { graph::output_nodes<BACKEND> outputs, const size_t num_rays, const bool add_reduction=false) { @autoreleasepool { NSError *error; library = [device newLibraryWithSource:[NSString stringWithCString:kernel_source.c_str() encoding:NSUTF8StringEncoding] Loading Loading @@ -122,7 +121,6 @@ namespace gpu { std::cout << " Number of groups : " << thread_groups << std::endl; std::cout << " Total problem size : " << threads_per_group*thread_groups << std::endl; } } //------------------------------------------------------------------------------ /// @brief Create a max compute pipeline. Loading Loading @@ -163,7 +161,6 @@ namespace gpu { /// the job. This method is asyncronus. //------------------------------------------------------------------------------ void run() { @autoreleasepool { command_buffer = [queue commandBuffer]; id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoderWithDispatchType:MTLDispatchTypeSerial]; Loading @@ -178,7 +175,6 @@ namespace gpu { [command_buffer commit]; } } //------------------------------------------------------------------------------ /// @brief Compute the max reduction. Loading
graph_tests/dispersion_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -110,6 +110,7 @@ template<typename BACKEND> void run_tests(const typename BACKEND::base tolarance /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU #ifdef USE_REDUCE #ifdef USE_CUDA run_tests<backend::cpu<float>> (3.2E-14); Loading @@ -126,4 +127,5 @@ int main(int argc, const char * argv[]) { run_tests<backend::cpu<std::complex<float>>> (2.0E-14); #endif run_tests<backend::cpu<std::complex<double>>> (1.0E-30); END_GPU }
graph_tests/jit_test.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -397,8 +397,10 @@ template<typename BASE> void run_tests() { /// @param[in] argv Array of commandline arguments. //------------------------------------------------------------------------------ int main(int argc, const char * argv[]) { START_GPU run_tests<float> (); run_tests<double> (); run_tests<std::complex<float>> (); run_tests<std::complex<double>> (); END_GPU }