{"id":65,"date":"2017-10-20T21:26:42","date_gmt":"2017-10-20T12:26:42","guid":{"rendered":"http:\/\/www.sciement.com\/tech-blog\/?p=65"},"modified":"2017-12-21T17:39:24","modified_gmt":"2017-12-21T08:39:24","slug":"cuda_in_ue4","status":"publish","type":"post","link":"https:\/\/www.sciement.com\/tech-blog\/c\/cuda_in_ue4\/","title":{"rendered":"[C++][CUDA][UE4]CUDA\u95a2\u6570\u3092Unreal Engine 4\u3067\u7528\u3044\u308b"},"content":{"rendered":"<p>\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u306e\u5f37\u529b\u306a\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9\u80fd\u529b\u306f\u3001\u30b2\u30fc\u30e0\u3084\u6620\u50cf\u306e\u7bc4\u7587\u3092\u8d8a\u3048\u3001\u300c\u7a7a\u9593\u300d\u306b\u95a2\u3059\u308b\u3042\u3089\u3086\u308b\u30c7\u30fc\u30bf\u306e\u63cf\u753b\u306b\u7528\u3044\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u533b\u7642\u3082\u305d\u306e1\u3064\u3067\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u306f\u63cf\u753b\u4ee5\u5916\u306e\u30ed\u30b8\u30c3\u30af\u90e8\u5206\u306f\u57fa\u672c\u7684\u306b\u306fCPU\u4e0a\u3067\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c9\u3067\u52d5\u3044\u3066\u304a\u308a\u3001\u9ad8\u8ca0\u8377\u306e\u8a08\u7b97\u3092\u6bce\u30d5\u30ec\u30fc\u30e0\u884c\u3063\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u8868\u793a\u3059\u308b\u3001\u3068\u3044\u3046\u3088\u3046\u306a\u3053\u3068\u3092\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u30b4\u30ea\u30b4\u30ea\u81ea\u5206\u3067\u5b9f\u88c5\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Unity\u3067\u3042\u308c\u3070C#\u3067\u3001Unreal Engine 4\u3067\u3042\u308c\u3070C++\u3067\u5b9f\u88c5\u3059\u308b\u306e\u304c\u57fa\u672c\u3067\u3059\u3002<br \/>\nUnreal Engine 4\u3092Windows\u30de\u30b7\u30f3\u3067\u7528\u3044\u308b\u5834\u5408\u3001Visual Studio\u306b\u6a19\u6e96\u3067\u5165\u3063\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308c\u3070\u3001\u5fc5\u8981\u306a\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u3060\u3051\u3067\u4e26\u5217\u5316\u306e\u5404\u7a2e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\uff08\u51fa\u6765\u307e\u3057\u305f\uff09\u3002<\/p>\n<p>CPU\u306b\u3088\u308bfor\u6587\u306e\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u51e6\u7406\u3067\u3042\u308c\u3070<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/dd492418.aspx\" rel=\"noopener\" target=\"_blank\"><strong>\u4e26\u5217\u30d1\u30bf\u30fc\u30f3 \u30e9\u30a4\u30d6\u30e9\u30ea (PPL)<\/strong><\/a><br \/>\nGPGPU\u306b\u3088\u308b\u4e26\u5217\u51e6\u7406\u3067\u3042\u308c\u3070<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/hh265137.aspx\" rel=\"noopener\" target=\"_blank\"><strong>C++ AMP (C++ Accelerated Massive Parallelism)<\/strong><\/a><\/p>\n<p>\u3092\u7528\u3044\u308c\u3070\u3001\u6c17\u8efd\u306b\u4e26\u5217\u5316\u3092\u884c\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\uff08\u51fa\u6765\u307e\u3057\u305f\uff09\u3002<br \/>\n\uff08\u4f46\u3057\u3001Unreal Engine 4\u7279\u6709\u306e\u554f\u984c\u3067\u3001C++ AMP\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306famp.h\u306a\u306e\u3067\u3059\u304c\u3001<strong>\u56f0\u3063\u305f\u3053\u3068\u306bUnreal Engine 4\u306e\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b<a href=\"https:\/\/docs.unrealengine.com\/latest\/INT\/API\/Runtime\/AudioMixer\/DSP\/FAmp\/index.html\" rel=\"noopener\" target=\"_blank\"><strong>Amp.h<\/strong><\/a>\u3068\u3044\u3046\u540c\u540d\u306e\u3082\u306e\u304c\u3042\u308a\u3001amp.h\u3092\u6b63\u3057\u304f\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3059\u308b\u305f\u3081\u306b\u306f\u7d76\u5bfe\u30d1\u30b9\u3092\u66f8\u304f\u5fc5\u8981\u304c\u3042\u308b<\/strong>\u3001\u3068\u3044\u3046\u306e\u304c\u3060\u3044\u3076\u843d\u3068\u3057\u7a74\u3067\u3057\u305f\u2026\u3002\u3053\u308c\u3001Epic Games\u3055\u3093\u304c\u4f55\u304b\u3057\u3089\u5bfe\u51e6\u3055\u308c\u305f\u307b\u3046\u304c\u826f\u3044\u306e\u3067\u306f\u2026\uff09<\/p>\n<p>C++ AMP\u306f\u7279\u5b9a\u306eGPU\u306b\u9650\u5b9a\u3055\u308c\u305a\u3001\u307e\u305f\u3001\u7528\u3044\u3066\u3044\u308bPC\u306bGPU\u304c\u7a4d\u307e\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306b\u306f\u81ea\u52d5\u7684\u306bCPU\u5074\u306b\u51e6\u7406\u3092\u884c\u308f\u305b\u308b\u3088\u3046\u306b\u3057\u3066\u304f\u308c\u308b\u3068\u3044\u3046\u70b9\u3067\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u30ab\u30fc\u30cd\u30eb\u95a2\u6570\u306e\u547c\u3073\u51fa\u3057\u30b3\u30b9\u30c8\u3084\u3001\u305d\u3082\u305d\u3082\u306e\u901f\u3055\u306b\u3064\u3044\u3066\u306f\u3001\u3084\u306f\u308aNVIDIA\u5c02\u7528\u306b\u6700\u9069\u5316\u3055\u308c\u3066\u3044\u308bCUDA\u306b\u306f\u6575\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u53c2\u8003\u8a18\u4e8b\uff1a<br \/>\n<a href=\"http:\/\/codinggorilla.domemtech.com\/?p=1135\" rel=\"noopener\" target=\"_blank\"><strong>Performance comparison of CUDA, OpenCL, and C++ AMP<\/strong><\/a><br \/>\n<a href=\"https:\/\/social.msdn.microsoft.com\/Forums\/vstudio\/en-US\/d959e3f3-2a85-4646-9c54-cae69c534b64\/poor-performance-with-c-amp-algorithms-library?forum=parallelcppnative\" rel=\"noopener\" target=\"_blank\"><strong>Poor performance with C++ AMP Algorithms Library<\/strong><\/a><\/p>\n<p>\u3068\u306a\u308b\u3068\u3084\u306f\u308aCUDA\u306e\u30ab\u30fc\u30cd\u30eb\u95a2\u6570\u3092\u76f4\u63a5\u7528\u3044\u305f\u3044\u308f\u3051\u3067\u3059\u304c\u3001CUDA\u3067\u8a18\u8f09\u3055\u308c\u305f.cu\u30d5\u30a1\u30a4\u30eb\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u306b\u306fCUDA\u30b3\u30f3\u30d1\u30a4\u30e9\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u305a\u3001Unreal Engine 4\u306e\u5834\u5408\u306f\u307e\u305aUnrealBuildTool\u304c\u50cd\u3044\u3066\u2026\u306a\u3069\u3001\u3069\u3053\u3092\u3069\u3046\u3059\u308c\u3070\u826f\u3044\u306e\u304b\u3088\u304f\u308f\u304b\u308a\u307e\u305b\u3093\u2026\u3002<\/p>\n<p>\u53c2\u8003\u8a18\u4e8b\uff1a<br \/>\n<a href=\"https:\/\/www.slideshare.net\/shunsasaki98\/unreal-buildtool\" rel=\"noopener\" target=\"_blank\"><strong>UnrealBuildTool\u52c9\u5f37\u4f1a\u307e\u3068\u3081<\/strong><\/a><\/p>\n<p>CUDA\u30b3\u30f3\u30d1\u30a4\u30e9\u304b\u3089\u751f\u6210\u3055\u308c\u305f\u4e2d\u9593\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb.obj\u3092Unreal Engine 4\u304b\u3089\u4f5c\u3089\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3068\u30ea\u30f3\u30af\u3057\u3066\u2026\u306a\u3069\u3001\u539f\u7406\u7684\u306b\u306f\u4f55\u3068\u304b\u306a\u308a\u305d\u3046\u306a\u6c17\u3082\u3057\u306a\u304f\u3082\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u7d50\u5c40\u3088\u304f\u308f\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u2026\u3002<\/p>\n<p>\u6d77\u5916\u306e\u30d5\u30a9\u30fc\u30e9\u30e0\u3092\u8abf\u3079\u308b\u3068\u3001CUDA\u30b3\u30fc\u30c9\u304b\u3089\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u3063\u3066\u8aad\u3081\u3070\u826f\u3044\u306e\u3067\u306f\uff1f\u3068\u3044\u3046\u793a\u5506\u306f\u3042\u308b\u3082\u306e\u306e\u3001\u5177\u4f53\u7684\u306a\u65b9\u6cd5\u306f\u304a\u305d\u3089\u304f\u307e\u3060\u3069\u3053\u306b\u3082\u8a18\u4e8b\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u53c2\u8003\u8a18\u4e8b\uff1a<br \/>\n<a href=\"https:\/\/forums.unrealengine.com\/development-discussion\/c-gameplay-programming\/116434-how-to-use-cuda-file-in-ue4\" rel=\"noopener\" target=\"_blank\"><strong>How to use CUDA file in UE4?<\/strong><\/a><\/p>\n<p>Facebook\u306eUnreal Engine 4\u975e\u516c\u5f0f\u30b0\u30eb\u30fc\u30d7\u3067\u805e\u3044\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u3084\u306f\u308a\u540c\u3058\u624b\u6cd5\u3092\u793a\u5506\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u2026\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u672c\u8170\u3092\u5165\u308c\u3066\u3084\u3063\u3066\u307f\u305f\u3068\u3053\u308d\u51fa\u6765\u307e\u3057\u305f\uff01<\/p>\n<p>\u5b9f\u884c\u74b0\u5883\u306f\u3001Windows 10, Unreal Engine 4.16.3, Visual Studio 2017\u3067\u3059\u3002<\/p>\n<p><strong>\u25c6CUDA\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/strong><br \/>\nVisual Studio\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3042\u3068\u3067CUDA\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n\u4e00\u6614\u524d\u306fCUDA\u74b0\u5883\u306e\u8a2d\u5b9a\u3060\u3051\u3067\u4e00\u82e6\u52b4\u3060\u3063\u305f\u3088\u3046\u306a\u306e\u3067\u3059\u304c\u3001\u3044\u307e\u306f\u4e0b\u8a18\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308c\u3070\u5168\u90e8\u52dd\u624b\u306b\u3084\u3063\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/developer.nvidia.com\/cuda-toolkit\/whatsnew\" rel=\"noopener\" target=\"_blank\"><strong>What\u2019s New in CUDA<\/strong><\/a><\/p>\n<p><strong>\u25c6CUDA\u306e\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\uff08.lib\uff09\u4f5c\u6210\u306e\u305f\u3081\u306e\u4e0b\u6e96\u5099<\/strong><br \/>\n\u4ed6\u306b\u3082\u3084\u308a\u65b9\u306f\u3044\u304f\u3089\u3067\u3082\u3042\u308b\u306e\u3060\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u4e0b\u8a18\u306e\u65b9\u6cd5\u304c\u9762\u5012\u306a\u8a2d\u5b9a\u3082\u307b\u3068\u3093\u3069\u306a\u304f\u3001\u4e00\u756a\u7c21\u5358\u3067\u3057\u305f\u3002<\/p>\n<p>1. CUDA\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new.jpg\" alt=\"\" width=\"1000\" height=\"600\" class=\"alignnone size-full wp-image-70\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new.jpg 1000w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new-300x180.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new-768x461.jpg 768w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new_project.jpg\" alt=\"\" width=\"1413\" height=\"811\" class=\"alignnone size-full wp-image-71\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new_project.jpg 1413w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new_project-300x172.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new_project-768x441.jpg 768w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_new_project-1024x588.jpg 1024w\" sizes=\"auto, (max-width: 1413px) 100vw, 1413px\" \/><\/p>\n<p>CUDA 9.0 Runtime\u3092\u9078\u3073\u307e\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d\u306f\u9069\u5f53\u306b\u6c7a\u3081\u3066\u4e0b\u3055\u3044\u3002\u4f55\u3067\u3082\u826f\u3044\u3067\u3057\u3087\u3046\u3002\u3053\u3053\u3067\u306fcuda_lib_test\u3068\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>2. \u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\u751f\u6210\u7528\u306e\u8a2d\u5b9a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_release.jpg\" alt=\"\" width=\"900\" height=\"280\" class=\"alignnone size-full wp-image-72\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_release.jpg 900w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_release-300x93.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_release-768x239.jpg 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><br \/>\nDebug\u30e2\u30fc\u30c9\u304b\u3089Release\u30e2\u30fc\u30c9\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<strong>Debug\u30e2\u30fc\u30c9\u306e\u307e\u307e\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u3063\u3066\u3057\u307e\u3046\u3068\u3001Unreal Engine 4\u3067\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u307e\u305b\u3093\uff01<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties01.jpg\" alt=\"\" width=\"900\" height=\"960\" class=\"alignnone size-full wp-image-74\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties01.jpg 900w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties01-281x300.jpg 281w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties01-768x819.jpg 768w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties01-300x320.jpg 300w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties02_.jpg\" alt=\"\" width=\"1254\" height=\"650\" class=\"alignnone size-full wp-image-75\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties02_.jpg 1254w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties02_-300x156.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties02_-768x398.jpg 768w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_project_properties02_-1024x531.jpg 1024w\" sizes=\"auto, (max-width: 1254px) 100vw, 1254px\" \/><br \/>\n<strong>Configuration\u304cRelease\u306b\u306a\u3063\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u3001Configuration Type\u3092Application (.exe)\u304b\u3089Static library (.lib)\u306b\u5207\u308a\u66ff\u3048\u307e\u3059<\/strong>\u3002<\/p>\n<p>\u3053\u308c\u3067\u8a2d\u5b9a\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p><strong>\u25c6CUDA\u95a2\u6570\u306e\u5b9f\u88c5<\/strong><br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u3001kernel.cu\u3068\u3044\u3046CUDA\u306e\u30b5\u30f3\u30d7\u30eb\u95a2\u6570\u304c\u81ea\u52d5\u7684\u306b\u4f5c\u3089\u308c\u307e\u3059\u306e\u3067\u3001\u6700\u4f4e\u9650\u306e\u7de8\u96c6\u3092\u3057\u307e\u3059\u3002<br \/>\nCUDA\u304c\u72ec\u81ea\u306b\u7528\u610f\u3057\u3066\u3044\u308b\u578b\u3092Unreal Engine 4\u4e0a\u304b\u3089\u3082\u554f\u984c\u306a\u304f\u4f7f\u3048\u308b\u304b\u78ba\u304b\u3081\u305f\u304b\u3063\u305f\u306e\u3067\u3001addWithCuda\u306e\u4ed6\u306bint4\u578b\u3092\u7528\u3044\u308baddWithCuda2\u3082\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u5f53\u7136\u3067\u3059\u304c\u3001\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u5207\u308a\u51fa\u3059\u4f5c\u696d\u3082\u5fc5\u8981\u3067\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:c++ decode:true \" title=\"cuda_lib_test.cu\" >\/\/ Copyright SCIEMENT, Inc.\r\n\/\/ by Hirofumi Seo, M.D., CEO & President\r\n\r\n#include \"cuda_lib_test.h\"\r\n\r\n\r\n__global__ void addKernel(int *c, const int *a, const int *b)\r\n{\r\n  int i = threadIdx.x;\r\n  c[i] = a[i] + b[i];\r\n}\r\n\r\n__global__ void addKernel2(int4 *c, const int4 *a, const int4 *b)\r\n{\r\n  int i = threadIdx.x;\r\n  c[i].x = a[i].x + b[i].x;\r\n  c[i].y = a[i].y + b[i].y;\r\n  c[i].z = a[i].z + b[i].z;\r\n  c[i].w = a[i].w + b[i].w;\r\n}\r\n\r\n\/\/ Helper function for using CUDA to add vectors in parallel.\r\ncudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size, std::string* error_message)\r\n{\r\n  int *dev_a = 0;\r\n  int *dev_b = 0;\r\n  int *dev_c = 0;\r\n  cudaError_t cuda_status;\r\n\r\n  \/\/ Choose which GPU to run on, change this on a multi-GPU system.\r\n  cuda_status = cudaSetDevice(0);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Allocate GPU buffers for three vectors (two input, one output)    .\r\n  cuda_status = cudaMalloc((void**)&amp;dev_c, size * sizeof(int));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMalloc((void**)&amp;dev_a, size * sizeof(int));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMalloc((void**)&amp;dev_b, size * sizeof(int));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Copy input vectors from host memory to GPU buffers.\r\n  cuda_status = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMemcpy(dev_b, b, size * sizeof(int), cudaMemcpyHostToDevice);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Launch a kernel on the GPU with one thread for each element.\r\n  addKernel &lt;&lt;&lt;1, size&gt;&gt;&gt; (dev_c, dev_a, dev_b);\r\n\r\n  \/\/ Check for any errors launching the kernel\r\n  cuda_status = cudaGetLastError();\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"addKernel launch failed: \" + std::string(cudaGetErrorString(cuda_status));\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ cudaDeviceSynchronize waits for the kernel to finish, and returns\r\n  \/\/ any errors encountered during the launch.\r\n  cuda_status = cudaDeviceSynchronize();\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaDeviceSynchronize returned error code \" + std::to_string(cuda_status) +\" after launching addKernel!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Copy output vector from GPU buffer to host memory.\r\n  cuda_status = cudaMemcpy(c, dev_c, size * sizeof(int), cudaMemcpyDeviceToHost);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\nError:\r\n  cudaFree(dev_c);\r\n  cudaFree(dev_a);\r\n  cudaFree(dev_b);\r\n\r\n  return cuda_status;\r\n}\r\n\r\n\/\/ Helper function for using CUDA to add vectors in parallel.\r\ncudaError_t addWithCuda2(int4 *c, const int4 *a, const int4 *b, std::string* error_message)\r\n{\r\n  int4 *dev_a = 0;\r\n  int4 *dev_b = 0;\r\n  int4 *dev_c = 0;\r\n  const unsigned int size = 1;\r\n  cudaError_t cuda_status;\r\n\r\n  \/\/ Choose which GPU to run on, change this on a multi-GPU system.\r\n  cuda_status = cudaSetDevice(0);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaSetDevice failed!  Do you have a CUDA-capable GPU installed?\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Allocate GPU buffers for three vectors (two input, one output)    .\r\n  cuda_status = cudaMalloc((void**)&amp;dev_c, size * sizeof(int4));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMalloc((void**)&amp;dev_a, size * sizeof(int4));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMalloc((void**)&amp;dev_b, size * sizeof(int4));\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMalloc failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Copy input vectors from host memory to GPU buffers.\r\n  cuda_status = cudaMemcpy(dev_a, a, size * sizeof(int4), cudaMemcpyHostToDevice);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  cuda_status = cudaMemcpy(dev_b, b, size * sizeof(int4), cudaMemcpyHostToDevice);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Launch a kernel on the GPU with one thread for each element.\r\n  addKernel2 &lt;&lt;&lt;1, size&gt;&gt;&gt; (dev_c, dev_a, dev_b);\r\n\r\n  \/\/ Check for any errors launching the kernel\r\n  cuda_status = cudaGetLastError();\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"addKernel launch failed: \" + std::string(cudaGetErrorString(cuda_status));\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ cudaDeviceSynchronize waits for the kernel to finish, and returns\r\n  \/\/ any errors encountered during the launch.\r\n  cuda_status = cudaDeviceSynchronize();\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaDeviceSynchronize returned error code \" + std::to_string(cuda_status) + \" after launching addKernel!\";\r\n    goto Error;\r\n  }\r\n\r\n  \/\/ Copy output vector from GPU buffer to host memory.\r\n  cuda_status = cudaMemcpy(c, dev_c, size * sizeof(int4), cudaMemcpyDeviceToHost);\r\n  if (cuda_status != cudaSuccess) {\r\n    *error_message = \"cudaMemcpy failed!\";\r\n    goto Error;\r\n  }\r\n\r\nError:\r\n  cudaFree(dev_c);\r\n  cudaFree(dev_a);\r\n  cudaFree(dev_b);\r\n\r\n  return cuda_status;\r\n}<\/pre>\n<pre class=\"lang:c++ decode:true \" title=\"cuda_lib_test.h\" >\/\/ Copyright SCIEMENT, Inc.\r\n\/\/ by Hirofumi Seo, M.D., CEO & President\r\n\r\n#pragma once\r\n\r\n#include &lt;string&gt;\r\n#include \"cuda_runtime.h\"\r\n#include \"vector_types.h\"\r\n#include \"vector_functions.h\"\r\n#include \"device_launch_parameters.h\"\r\n\r\ncudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size, std::string* error_message);\r\ncudaError_t addWithCuda2(int4 *c, const int4 *a, const int4 *b, std::string* error_message);\r\n<\/pre>\n<p>Unreal Engine 4\u3067\u306efprintf\u306f\u826f\u304f\u308f\u304b\u3089\u306a\u3044\u306e\u3067\uff08\u77e5\u8b58\u304c\u306a\u3044\u3060\u3051\u3067\u3059\u304c\u2026\uff09\u3001UE_LOG\u3067\u8868\u793a\u51fa\u6765\u308b\u3088\u3046\u306bstd::string\u3092\u4f5c\u3063\u3066\u30a8\u30e9\u30fc\u8868\u793a\u3092<br \/>\n <span class=\"lang:c++ decode:true  crayon-inline \" >fprintf(stderr, &#8220;xxxxx&#8221;);<\/span><br \/>\n\u304b\u3089<br \/>\n <span class=\"lang:c++ decode:true  crayon-inline \" >*error_message = &#8220;xxxxx&#8221;;<\/span><br \/>\n\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3042\u3068\u306f\u57fa\u672c\u7684\u306b\u306f\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u305d\u306e\u307e\u307e\u3067\u3059\u3002<\/p>\n<p><strong>\u25c6CUDA\u306e\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\uff08.lib\uff09\u306e\u4f5c\u6210<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_build.jpg\" alt=\"\" width=\"760\" height=\"180\" class=\"alignnone size-full wp-image-83\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_build.jpg 760w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/VisualStudio_build-300x71.jpg 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><br \/>\n\u30d3\u30eb\u30c9\u3059\u308b\u3060\u3051\u3067\u3059\u3002\u30a8\u30e9\u30fc\u304c\u306a\u3051\u308c\u3070\u3001\u3053\u308c\u3067.lib\u304c\u4f5c\u3089\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_lib.jpg\" alt=\"\" width=\"1025\" height=\"222\" class=\"alignnone size-full wp-image-84\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_lib.jpg 1025w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_lib-300x65.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_lib-768x166.jpg 768w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_lib-1024x222.jpg 1024w\" sizes=\"auto, (max-width: 1025px) 100vw, 1025px\" \/><br \/>\n<strong>ProjectPath\/x64\/Release\u30d5\u30a9\u30eb\u30c0\u306b.lib\u304c\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059<\/strong>\u3002<\/p>\n<p><strong>\u25c6Unreal Engine 4\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u4f5c\u6210<\/strong><br \/>\n\u4f55\u3067\u3082\u826f\u3044\u306e\u3067\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002CUDATest\u3068\u3044\u3046C++ Project\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3057\u3066\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u305f\u3081\u306b\u9069\u5f53\u306bC++ Class\u3092\u4f5c\u308a\u307e\u3059\u3002CUDA_test\u3068\u3044\u3046Actor\u7d99\u627f\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/Folder_UE.jpg\" alt=\"\" width=\"760\" height=\"400\" class=\"alignnone size-full wp-image-85\" \/><br \/>\n\u305d\u3057\u3066\u3001\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3068\u5148\u307b\u3069\u4f5c\u3063\u305f.lib\u30d5\u30a1\u30a4\u30eb\u3092\u8a72\u5f53\u306eUnreal Engine 4\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30d5\u30a9\u30eb\u30c0\u4e0b\u5c64\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u3082\u3061\u308d\u3093\u30b3\u30d4\u30fc\u3057\u306a\u304f\u3066\u3082\u6307\u5b9a\u3059\u308c\u3070\u4f7f\u3048\u307e\u3059\u304c\u3001\u30b3\u30d4\u30fc\u3057\u3066\u304a\u3044\u305f\u307b\u3046\u304c\u4f55\u304b\u3068\u624b\u9593\u304c\u7701\u3051\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u306fCUDALib\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u308a\u3001\u3055\u3089\u306binclude\u30d5\u30a9\u30eb\u30c0\u3001lib\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u308a\u3001\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3068.lib\u30d5\u30a1\u30a4\u30eb\u3092\u305d\u308c\u305e\u308c\u30b3\u30d4\u30fc\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u25c6Visual Studio\u306e\u8a2d\u5b9a<\/strong><br \/>\n\u4e00\u3064\u3060\u3051\u3084\u308b\u3068\u3059\u308c\u3070\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eProperties\u3067VC++ Directories\u306eInclude Directories\u306b\u5148\u307b\u3069\u4f5c\u3063\u305finclude\u30d5\u30a9\u30eb\u30c0\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u304b\u3002\u3053\u3046\u3059\u308b\u3068IntelliSense\u304c\u50cd\u3044\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p><strong>\u25c6Build.cs\u306e\u8a2d\u5b9a<\/strong><br \/>\n\u3053\u3053\u304c\u4e00\u756a\u5927\u4e8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:c# mark:9-12,23-24,26-27,29-31,33,35-36 decode:true \" title=\"CUDATest.Build.cs\" >\/\/ Copyright SCIEMENT, Inc.\r\n\/\/ by Hirofumi Seo, M.D., CEO &amp; President\r\n\r\nusing UnrealBuildTool;\r\nusing System.IO;\r\n\r\npublic class CUDATest : ModuleRules\r\n{\r\n    private string poject_root_path\r\n    {\r\n        get { return Path.Combine(ModuleDirectory, \"..\/..\"); }\r\n    }\r\n\r\n    public CUDATest(ReadOnlyTargetRules Target) : base(Target)\r\n    {\r\n        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;\r\n\r\n        PublicDependencyModuleNames.AddRange(new string[] { \"Core\", \"CoreUObject\", \"Engine\", \"InputCore\" });\r\n\r\n        PrivateDependencyModuleNames.AddRange(new string[] { });\r\n\r\n\r\n        string custom_cuda_lib_include = \"CUDALib\/include\";\r\n        string custom_cuda_lib_lib = \"CUDALib\/lib\";\r\n\r\n        PublicIncludePaths.Add(Path.Combine(poject_root_path, custom_cuda_lib_include));\r\n        PublicAdditionalLibraries.Add(Path.Combine(poject_root_path, custom_cuda_lib_lib, \"cuda_lib_test.lib\"));\r\n\r\n        string cuda_path = \"C:\/Program Files\/NVIDIA GPU Computing Toolkit\/CUDA\/v9.0\";\r\n        string cuda_include = \"include\";\r\n        string cuda_lib = \"lib\/x64\";\r\n\r\n        PublicIncludePaths.Add(Path.Combine(cuda_path, cuda_include));\r\n\r\n        \/\/PublicAdditionalLibraries.Add(Path.Combine(cuda_path, cuda_lib, \"cudart.lib\"));\r\n        PublicAdditionalLibraries.Add(Path.Combine(cuda_path, cuda_lib, \"cudart_static.lib\"));\r\n\r\n        \/\/ Uncomment if you are using Slate UI\r\n        \/\/ PrivateDependencyModuleNames.AddRange(new string[] { \"Slate\", \"SlateCore\" });\r\n\r\n        \/\/ Uncomment if you are using online features\r\n        \/\/ PrivateDependencyModuleNames.Add(\"OnlineSubsystem\");\r\n\r\n        \/\/ To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true\r\n    }\r\n}\r\n<\/pre>\n<p>27\u884c\u76ee\u307e\u3067\u304c\u81ea\u5206\u3067\u4f5c\u3063\u305f.lib\u3068\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u300129\u884c\u76ee\u304b\u3089\u304cCUDA\u7528\u306e\u8a2d\u5b9a\u3067\u3059\u3002<br \/>\nCUDA 9.0\u306e\u5834\u5408\u3001\u6a19\u6e96\u7684\u306a\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u306f<br \/>\nC:\/Program Files\/NVIDIA GPU Computing Toolkit\/CUDA\/v9.0<br \/>\n\u4ee5\u4e0b\u306b\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u3084.lib\u30d5\u30a1\u30a4\u30eb\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<br \/>\nCUDA 9.0\u306e.lib\u306f\u3001cudart_static.lib\u3067\u3082\u3001\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u3044\u308bcudart.lib\u3067\u3082\u3069\u3061\u3089\u3067\u3082\u5927\u4e08\u592b\u3067\u3059\u3002\u4e21\u65b9\u6307\u5b9a\u3059\u308b\u3068\u3069\u3046\u306a\u308b\u306e\u304b\u306f\u3088\u304f\u308f\u304b\u308a\u307e\u305b\u3093\uff08\u672a\u691c\u8a3c\uff09\u3002<br \/>\n\u3053\u306e2\u3064\u306e\u9055\u3044\u306f\u4f8b\u3048\u3070\u4ee5\u4e0b\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/devtalk.nvidia.com\/default\/topic\/1014507\/cuda-programming-and-performance\/cudart-lib-vs-cudart_static-lib\/\" rel=\"noopener\" target=\"_blank\"><strong>cudart.lib vs. cudart_static.lib &#8211; NVIDIA Developer Forums<\/strong><\/a><br \/>\ncudart_static.lib\u306f\u3001\u305d\u306e\u540d\u306e\u901a\u308a\u9759\u7684\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3001.exe\u306b\u3057\u305f\u969b\u306b.dll\u304c\u4e0d\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>CUDA_test Actor\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u691c\u8a3c\u7528\u306a\u306e\u3067\u5b9f\u88c5\u306f\u30d8\u30c3\u30c0\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"lang:c++ mark:21-54 decode:true \" title=\"CUDA_test.h\" >\/\/ Copyright SCIEMENT, Inc.\r\n\/\/ by Hirofumi Seo, M.D., CEO &amp; President\r\n\r\n#pragma once\r\n\r\n#include \"CoreMinimal.h\"\r\n#include \"cuda_lib_test.h\"\r\n#include \"GameFramework\/Actor.h\"\r\n#include \"cuda_runtime.h\"\r\n#include \"CUDA_test.generated.h\"\r\n\r\nUCLASS()\r\nclass CUDATEST_API ACUDA_test : public AActor\r\n{\r\n  GENERATED_BODY()\r\n\r\npublic:\r\n  \/\/ Sets default values for this actor's properties\r\n  ACUDA_test();\r\n\r\n  UFUNCTION(BlueprintCallable, Category = \"CUDATest\")\r\n  bool SimpleCUDATest() {\r\n    \/\/ ----- addWithCuda test -----\r\n    const int arraySize = 5;\r\n    const int a[arraySize] = { 1, 2, 3, 4, 5 };\r\n    const int b[arraySize] = { 10, 20, 30, 40, 50 };\r\n    int c[arraySize] = { 0 };\r\n    std::string error_message;\r\n\r\n    \/\/ Add vectors in parallel.\r\n    cudaError_t cuda_status = addWithCuda(c, a, b, arraySize, &amp;error_message);\r\n    if (cuda_status != cudaSuccess) {\r\n      UE_LOG(LogTemp, Warning, TEXT(\"addWithCuda failed!\\n\"));\r\n      UE_LOG(LogTemp, Warning, TEXT(\"%s\"), *FString(error_message.c_str()));\r\n      return false;\r\n    }\r\n    UE_LOG(LogTemp, Warning, TEXT(\"{1,2,3,4,5} + {10,20,30,40,50} = {%d,%d,%d,%d,%d}\"), c[0], c[1], c[2], c[3], c[4]);\r\n\r\n    \/\/ ----- addWithCuda2 test -----\r\n    const int4 a_int4 = make_int4(1, 2, 3, 4);\r\n    const int4 b_int4 = make_int4(10, 20, 30, 40);\r\n    int4 c_int4;\r\n\r\n    \/\/ Add vectors in parallel.\r\n    cuda_status = addWithCuda2(&amp;c_int4, &amp;a_int4, &amp;b_int4, &amp;error_message);\r\n    if (cuda_status != cudaSuccess) {\r\n      UE_LOG(LogTemp, Warning, TEXT(\"addWithCuda failed!\\n\"));\r\n      UE_LOG(LogTemp, Warning, TEXT(\"%s\"), *FString(error_message.c_str()));\r\n      return false;\r\n    }\r\n    UE_LOG(LogTemp, Warning, TEXT(\"{1,2,3,4} + {10,20,30,40} = {%d,%d,%d,%d}\"), c_int4.x, c_int4.y, c_int4.z, c_int4.w);\r\n\r\n    return true;\r\n  }\r\n\r\nprotected:\r\n  \/\/ Called when the game starts or when spawned\r\n  virtual void BeginPlay() override;\r\n\r\npublic:\r\n  \/\/ Called every frame\r\n  virtual void Tick(float DeltaTime) override;\r\n\r\n};\r\n<\/pre>\n<p><strong>\u3053\u308c\u3067\u30d3\u30eb\u30c9\u304c\u901a\u308a\u307e\u3059\uff01\uff01\uff01<\/strong><\/p>\n<p><strong>\u25c6Unreal Editor\u5185\u3067\u306e\u8a2d\u5b9a<\/strong><br \/>\n\u7279\u306b\u7279\u5225\u306a\u3053\u3068\u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u3053\u3053\u3067\u306fCUDA_test\u30af\u30e9\u30b9\u304b\u3089Blueprint\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u3001\u30af\u30e9\u30b9\u95a2\u6570\u3067\u5148\u307b\u3069\u4f5c\u3063\u305fSimpleCUDATest()\u3092\u547c\u3073\u51fa\u3059\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3092\u30b7\u30fc\u30f3\u5185\u306b\u914d\u7f6e\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_BP.jpg\" alt=\"\" width=\"880\" height=\"300\" class=\"alignnone size-full wp-image-91\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_BP.jpg 880w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_BP-300x102.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_BP-768x262.jpg 768w\" sizes=\"auto, (max-width: 880px) 100vw, 880px\" \/><\/p>\n<p>\u5b9f\u884c\u3057\u307e\u3059\u3002Window -> Developer Tools -> Output Log\u3067Output Log\u3092\u51fa\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<strong>Play!<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_output_.jpg\" alt=\"\" width=\"860\" height=\"210\" class=\"alignnone size-full wp-image-92\" srcset=\"https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_output_.jpg 860w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_output_-300x73.jpg 300w, https:\/\/www.sciement.com\/tech-blog\/wp-content\/uploads\/2017\/10\/UE4_output_-768x188.jpg 768w\" sizes=\"auto, (max-width: 860px) 100vw, 860px\" \/><\/p>\n<p><strong>CUDA\u306e\u30ab\u30fc\u30cd\u30eb\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u3066\u3001\u8db3\u3057\u7b97\u304c\u6b63\u3057\u304f\u8a08\u7b97\u51fa\u6765\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\uff01<br \/>\n\u3084\u3063\u305f\u306d\u3063\uff01\uff01\uff01<\/strong><\/p>\n<p>\u2026\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u6b63\u76f4\u3053\u308c\u3067\u306fGPU\u306e\u6027\u80fd\u3092\u4f55\u4e00\u3064\u6d3b\u304b\u3057\u3066\u3044\u306a\u3044\u308f\u3051\u3067\u3059\u304c\u3001\u3057\u304b\u3057\u3053\u308c\u3067Unreal Engine 4\u3067CUDA\u3092\u64cd\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\uff01<br \/>\n\u5927\u624b\u306e\u4f1a\u793e\u3084\u6709\u511f\u30b5\u30dd\u30fc\u30c8\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u5185\u3067\u306f\u5f53\u305f\u308a\u524d\u306a\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u516c\u306b\u306a\u3063\u3066\u3044\u308b\u8a18\u4e8b\u306f\u304a\u305d\u3089\u304f\u3053\u308c\u304c\u4e16\u754c\u521d\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u5927\u898f\u6a21\u8a08\u7b97\u306e\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u53ef\u8996\u5316\u306a\u3069\u306bUnreal Engine 4\u3092\u4f7f\u3046\u306e\u3082\u826f\u3044\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f<\/strong><br \/>\n\uff08\u305d\u3093\u306a\u6848\u4ef6\u304c\u3042\u308a\u307e\u3057\u305f\u3089\u305c\u3072\uff01<strong><a href=\"http:\/\/www.sciement.com\/jp\/contact\/\" rel=\"noopener\" target=\"_blank\"><strong>\u30b5\u30a4\u30a2\u30e1\u30f3\u30c8\u306eContact\u30da\u30fc\u30b8<\/strong><\/a>\u304b\u3089\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304f\u3060\u3055\u3044\u3002<\/strong>\uff09<\/p>\n<hr \/>\n<p>\u203b\u672c\u8a18\u4e8b\u5185\u5bb9\u306f\u3001\u56fd\u7acb\u7814\u7a76\u958b\u767a\u6cd5\u4eba \u65e5\u672c\u533b\u7642\u7814\u7a76\u958b\u767a\u6a5f\u69cb\uff08AMED\uff09\u306e<a href=\"https:\/\/www.amed.go.jp\/koubo\/02\/01\/0201C_00124.html\" rel=\"noopener\" target=\"_blank\">\u5e73\u621029\u5e74\u5ea6 \u300c\u672a\u6765\u533b\u7642\u3092\u5b9f\u73fe\u3059\u308b\u533b\u7642\u6a5f\u5668\u30fb\u30b7\u30b9\u30c6\u30e0\u7814\u7a76\u958b\u767a\u4e8b\u696d\u300e\u8853\u4e2d\u306e\u8fc5\u901f\u306a\u5224\u65ad\u30fb\u6c7a\u5b9a\u3092\u652f\u63f4\u3059\u308b\u305f\u3081\u306e\u8a3a\u65ad\u652f\u63f4\u6a5f\u5668\u30fb\u30b7\u30b9\u30c6\u30e0\u958b\u767a\u300f\u300d\u63a1\u629e\u8ab2\u984c<\/a>\u3067\u3042\u308b\u300c\u8853\u524d\u3068\u8853\u4e2d\u3092\u3064\u306a\u3050\u30b9\u30de\u30fc\u30c8\u624b\u8853\u30ac\u30a4\u30c9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u958b\u767a\u300d\uff08\u4ee3\u8868\u6a5f\u95a2\u540d\uff1a\u6771\u4eac\u5927\u5b66\u3001\u7814\u7a76\u958b\u767a\u4ee3\u8868\u8005\u540d\uff1a\u9f4a\u85e4\u5ef6\u4eba\uff09\u306b\u3001\u6771\u4eac\u5927\u5b66\u5927\u5b66\u9662\u60c5\u5831\u7406\u5de5\u5b66\u7cfb\u7814\u7a76\u79d1\u306e\u5b66\u8853\u652f\u63f4\u5c02\u9580\u8077\u54e1\u3068\u3057\u3066\u53c2\u753b\u3057\u3066\u3044\u308b\u702c\u5c3e\u62e1\u53f2\u304c\u3001\u7814\u7a76\u958b\u767a\u3068\u3057\u3066\u884c\u3063\u3066\u3044\u308b\u3082\u306e\u3084\u305d\u306e\u6210\u679c\u3092\u4e00\u90e8\u542b\u3093\u3067\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u306e\u5f37\u529b\u306a\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30b9\u80fd\u529b\u306f\u3001\u30b2\u30fc\u30e0\u3084\u6620\u50cf\u306e\u7bc4\u7587\u3092\u8d8a\u3048\u3001\u300c\u7a7a\u9593\u300d\u306b\u95a2\u3059\u308b\u3042\u3089\u3086\u308b\u30c7\u30fc\u30bf\u306e\u63cf\u753b\u306b\u7528\u3044\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u533b\u7642\u3082\u305d\u306e1\u3064\u3067\u3059\u3002 \u305f\u3060\u3001\u30b2\u30fc\u30e0\u30a8\u30f3\u30b8\u30f3\u306f\u63cf\u753b\u4ee5\u5916\u306e\u30ed\u30b8\u30c3\u30af\u90e8\u5206\u306f\u57fa\u672c\u7684\u306b\u306fCPU\u4e0a\u3067\u30b7 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,6],"tags":[],"class_list":["post-65","post","type-post","status-publish","format-standard","hentry","category-c","category-cuda","category-unreal-engine-4"],"_links":{"self":[{"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/posts\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/comments?post=65"}],"version-history":[{"count":35,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/posts\/65\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/posts\/65\/revisions\/189"}],"wp:attachment":[{"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/media?parent=65"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/categories?post=65"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sciement.com\/tech-blog\/wp-json\/wp\/v2\/tags?post=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}