C++高性能并行编程与优化 - 课件 - 09 CUDA C++ 流体仿真实战CUDA 编译器,链接 OpenVDB 在 Blender 中查看导出的结果 边界条件 边界条件:初始化 边界条件:添加判断边界的版本 边界条件:仅在第一层额外判断边界条件 进一步改进 VDB 导出:支持导出多个网格,并指定名称 进一步改进 VDB 导出: P-IMPL 模式 进一步改进 VDB 导出: F-IMPL 模式 Blender 渲染结果 改进 改进边界条件:外部边界流出而不是反弹,内部边界可以流出速度 改进边界条件:外部边界流出而不是反弹,内部边界可以流出速度 Blender 中调整一下材质 Blender 中调整一下材质 改进对流:让烟雾随时间逐渐褪色 改进对流:让烟雾随时间逐渐褪色 改进褪色:不是褪色 density ,而是褪色 temperature 改进褪色:不是褪色 density ,而是褪色 temperature 改进褪色:不是单纯地乘以 decayRate ,还和周围环境温度求平均值0 码力 | 58 页 | 14.90 MB | 1 年前3
Back to Basics: The Factory Patternpattern is actually used ○ grep -irn “factory” . ● The answer is yes! ● https://github.com/blender/blender ● ● ●Factory Method/Pattern Usage (5/6) 81 ● I dug around a few open source projects to see0 码力 | 93 页 | 3.92 MB | 6 月前3
What's New in Visual Studio 2022915 505 272 878 1059 2886 0 500 1000 1500 2000 2500 3000 3500 Unreal Engine 5 TensorFlow Blender AAA Game 3 AAA Game 2 AAA Game 1 Time in Seconds (Lower is better) VS 17.5 VS 17.7In Visual0 码力 | 55 页 | 3.27 MB | 6 月前3
C++高性能并行编程与优化 - 课件 - 05 C++11 开始的多线程编程函数,从而保证 pool 解 构时会自动等待全部线程执行完毕。 小彭老师快乐吐槽时间 • 多线程、异步、无阻塞、并发,能提升程序响应速度,对现实世界中的软件工程至关重要 。 • 反面教材: blender 在运行物理解算的时候,界面会卡住,算完一帧后窗口才能刷新一遍 ,导致解算过程中基本别想做事,这一定程度上归功于 opengl 原始的单线程设计。 • 正面教材: zeno 可以在解算过程中0 码力 | 79 页 | 14.11 MB | 1 年前3
Au Units37.5Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m 38Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m (meters / second)(8.0) 8.0_mps // New manual definition Functions UDLs meters(3.0) 3.0_m (meters / second)(8.0) 8.0_mps // New manual definition 😞 meters(3.0f) ??? 38.2Unit symbol APIs (e.g., literals) Functions UDLs meters(3.0) 3.0_m (meters / second)(8 0_mps // New manual definition 😞 meters(3.0f) ??? meters(dist_m) ??? 38.3Unit symbol APIs (e.g., literals) Functions UDLs Unit Symbols meters(3.0) 3.0_m 3.0 * m (meters / second)(8.0) 8.0_mps //0 码力 | 191 页 | 22.37 MB | 6 月前3
Linear Algebra with The Eigen Cpp LibraryMatrixXd mtx { {1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}, {10.0, 11.0, 12.0} }; MatrixXd mtx{4, 3}; // 4 rows, 3 columns mtx << 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0; MatrixXd mtx{2, 2}; // 0-index as is the case in C++ generally: mtx(0, 0) = 3.0; mtx(1, 0) = 2.5; mtx(0, 1) = -1.0; mtx(1, 1) = mtx3(1, 0) + mtx3(0, 1); // Similar for Vector Eigen::MatrixXd; MatrixXd A { {1.0, 2.0, 3.0}, {1.5, 2.5, 3.5}, {4.0, 5.0, 6.0}, {4.5, 5.5, 6.5}, {7.0, 8.0, 9.0} }; MatrixXd B { {1.0, 2.0, 3.0, 4.0, 5.0}, {1.5, 2.5, 3.5, 40 码力 | 35 页 | 1.10 MB | 6 月前3
A Long Journey of Changing std::sort Implementation at Scalesort {3.0, NaN, 4.0}? 63Can we sort {3.0, NaN, 4.0}? No 63.1Can we sort {3.0, NaN, 4.0}? No NaN thinks it is equal to 3.0 and 4.0 63.2Can we sort {NaN, 3.0, NaN}? 64Can we sort {NaN, 3.0, NaN}? Yes 64.1Can we sort {NaN, 3.0, NaN}? Yes All elements are equal 64.2WHAT ARE WE CHANGING? 65WHAT ARE WE CHANGING? A�er these cleanups we can change to any sort 65.1WHAT ARE WE CHANGING? A�er0 码力 | 182 页 | 7.65 MB | 6 月前3
Improving Our Safety With a Quantities and Units Librarythe following equation? Pint 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz auto res = 1 * Hz + 1 * Bq + 1 * Bd; CppCon 2024: Improving our safety with a quantities and the following equation? Pint 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz print(1 * ureg.becquerel + 1 * ureg.hertz + 1 * ureg.baud) auto res = 1 * Hz + 1 * Bq 82print(1 * ureg.hertz + 1 * ureg.becquerel + 1 * ureg.baud) 3.0 hertz print(1 * ureg.becquerel + 1 * ureg.hertz + 1 * ureg.baud) 3.0 becquerel auto res = 1 * Hz + 1 * Bq + 1 * Bd; CppCon 2024:0 码力 | 207 页 | 6.93 MB | 6 月前3
Back to Basics: C++ Templates - Part 2void Main() 14 { 15 int a = 2; 16 int b = 1; 17 18 printf(”%d\n”, equal(a, b)); 19 20 double d = 3.0; 21 double f = 4.0; 22 23 printf(”%d\n”, equal(d, f)); 24 } Andreas Fertig v1.0 B2B: C++ Templates void Main() 16 { 17 int a = 2; 18 int b = 1; 19 20 printf(”%d\n”, equal(a, b)); 21 22 double d = 3.0; 23 double f = 4.0; 24 25 printf(”%d\n”, equal(d, f)); 26 } Andreas Fertig v1.0 B2B: C++ Templates void Main() 18 { 19 int a = 2; 20 int b = 1; 21 22 printf(”%d\n”, equal(a, b)); 23 24 double d = 3.0; 25 double f = 4.0; 26 27 printf(”%d\n”, equal(d, f)); 28 } Andreas Fertig v1.0 B2B: C++ Templates0 码力 | 12 页 | 787.22 KB | 6 月前3
Vectorizing a CFD Code With std::simd Supplemented by Transparent Loading and StoringtemplateT LogMean(const T &val1, const T &val2) { // ... if (u < thres) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); else twoF = log(zeta) / f; // ... } template T LogMean(const const T &val2) { // ... auto mask = u < thres; if (stdx::any_of(mask)) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); if (!stdx::all_of(mask)) where(!mask, twoF) = log(zeta) / f; // template T LogMean(const T &val1, const T &val2) { // ... if (u < thres) twoF = 2.0 + u * (2.0 / 3.0 + u * (0.4 + 2.0 / 7.0 * u)); else twoF = log(zeta) / f; // ... } template T LogMean(const 0 码力 | 58 页 | 2.68 MB | 6 月前3
共 108 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11













