 Making Libraries Consumable for Non-C++ Developersorg/ Garbage collection is really “automatic memory management”. - Reference counted - C++ – std::shared_ptr Making Libraries Consumable for Non-C++ Developersorg/ Garbage collection is really “automatic memory management”. - Reference counted - C++ – std::shared_ptr- - Python - Objective-C (manual or automatic – see ARC) - Swift - COM – AddRef()/Release() C# has fixed keyword. • Conforming JVM implementations have the option.Memory model Control of “shared” memory needs to be documented and/or agreed upon. GCs make this far more complicated since they DoTheThing(in BlubT b); Result: Windows – everything passed. Linux – everything failed. Why?Making Libraries Consumable for Non-C++ Developers Aaron R Robinson arobins@microsoft.com https://github. 0 码力 | 29 页 | 1.21 MB | 6 月前3
 Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!danielanderson.net What we’ll learn today • How shared_ptr is implemented under the hood • Atomics and concurrency patterns • How existing atomic<shared_ptr> are implemented (the split reference count used for • You’ve heard of shared_ptr Things we won’t cover • Alias pointers, weak pointers4 Daniel Anderson -- danielanderson.net What we’ll learn today • How shared_ptr is implemented under the the hood • Atomics and concurrency patterns • How existing atomic<shared_ptr> are implemented (the split reference count technique) • Deferred reclamation, i.e., garbage collection in C++ Some assumed0 码力 | 45 页 | 5.12 MB | 6 月前3 Lock-Free Atomic Shared Pointers Without a Split Reference Count? It Can Be Done!danielanderson.net What we’ll learn today • How shared_ptr is implemented under the hood • Atomics and concurrency patterns • How existing atomic<shared_ptr> are implemented (the split reference count used for • You’ve heard of shared_ptr Things we won’t cover • Alias pointers, weak pointers4 Daniel Anderson -- danielanderson.net What we’ll learn today • How shared_ptr is implemented under the the hood • Atomics and concurrency patterns • How existing atomic<shared_ptr> are implemented (the split reference count technique) • Deferred reclamation, i.e., garbage collection in C++ Some assumed0 码力 | 45 页 | 5.12 MB | 6 月前3
 C++高性能并行编程与优化 -  课件 - 11 现代 CMake 进阶指南https://www.scivision.dev/cmake-object-libraries/ 对象库类似于静态库,但不生成 .a 文件,只由 CMake 记住该库生成了哪些对象文件 改进: mylib 作为一个对象库 https://www.scivision.dev/cmake-object-libraries/ 对象库类似于静态库,但不生成 .a 文件,只由 CMake 记住该库生成了哪些对象文件 会根据 BUILD_SHARED_LIBS 这个变量的值决定是动态库还是静态库。 ON 则相当于 SHARED , OFF 则相当于 STATIC 。 如果未指定 BUILD_SHARED_LIBS 变量,则默认为 STATIC 。 因此,如果发现一个项目里的 add_library 都是无参数的,意味着你可以用 : cmake -B build -DBUILD_SHARED_LIBS:BOOL=ON 量的规则。 小技巧:设定一个变量的默认值 要让 BUILD_SHARED_LIBS 默认为 ON ,可以用下图这个方法: 如果该变量没有定义,则设为 ON ,否则保持用户指定的值不变。 这样当用户没有指定 BUILD_SHARED_LIBS 这个变量时,会默认变成 ON 。 也就是说除非用户指定了 -DBUILD_SHARED_LIBS:BOOL=OFF 才会生成 静态库,否则默认是生成动态库。0 码力 | 166 页 | 6.54 MB | 1 年前3 C++高性能并行编程与优化 -  课件 - 11 现代 CMake 进阶指南https://www.scivision.dev/cmake-object-libraries/ 对象库类似于静态库,但不生成 .a 文件,只由 CMake 记住该库生成了哪些对象文件 改进: mylib 作为一个对象库 https://www.scivision.dev/cmake-object-libraries/ 对象库类似于静态库,但不生成 .a 文件,只由 CMake 记住该库生成了哪些对象文件 会根据 BUILD_SHARED_LIBS 这个变量的值决定是动态库还是静态库。 ON 则相当于 SHARED , OFF 则相当于 STATIC 。 如果未指定 BUILD_SHARED_LIBS 变量,则默认为 STATIC 。 因此,如果发现一个项目里的 add_library 都是无参数的,意味着你可以用 : cmake -B build -DBUILD_SHARED_LIBS:BOOL=ON 量的规则。 小技巧:设定一个变量的默认值 要让 BUILD_SHARED_LIBS 默认为 ON ,可以用下图这个方法: 如果该变量没有定义,则设为 ON ,否则保持用户指定的值不变。 这样当用户没有指定 BUILD_SHARED_LIBS 这个变量时,会默认变成 ON 。 也就是说除非用户指定了 -DBUILD_SHARED_LIBS:BOOL=OFF 才会生成 静态库,否则默认是生成动态库。0 码力 | 166 页 | 6.54 MB | 1 年前3
 whats new in visual studiothe creation of the C++ Standards 2. by investing in the Microsoft Visual C++ (MSVC) Compiler & Libraries 3. by simplifying acquisition in C++ via vcpkg 4. by improving the Visual Studio IDE 5. by continuing your dependencies with the latest compiler 💡 Have peace of mind upgrading all your open-source libraries with vcpkg (https://vcpkg.io) Next: Upgrade to future minor releases of the MSVC toolset at your generally-available • x86 and X64 support • Debug configurations (/MTd, /MDd) included • Runtime libraries automatically linked for command-line builds Visual Studio integration • MSBuild & CMake support0 码力 | 42 页 | 19.02 MB | 6 月前3 whats new in visual studiothe creation of the C++ Standards 2. by investing in the Microsoft Visual C++ (MSVC) Compiler & Libraries 3. by simplifying acquisition in C++ via vcpkg 4. by improving the Visual Studio IDE 5. by continuing your dependencies with the latest compiler 💡 Have peace of mind upgrading all your open-source libraries with vcpkg (https://vcpkg.io) Next: Upgrade to future minor releases of the MSVC toolset at your generally-available • x86 and X64 support • Debug configurations (/MTd, /MDd) included • Runtime libraries automatically linked for command-line builds Visual Studio integration • MSBuild & CMake support0 码力 | 42 页 | 19.02 MB | 6 月前3
 Bringing Existing Code to CUDA Using constexpr and std::pmrMemory System Memory GPU Memory 12 |“Unified Memory creates a pool of managed memory that is shared between the CPU and GPU, bridging the CPU-GPU divide. Managed memory is accessible to both the CPU i = 0; i < n; i++) y[i] += f(i); } 23 |“Unified Memory creates a pool of managed memory that is shared between the CPU and GPU, bridging the CPU-GPU divide. Managed memory is accessible to both the ++i) for (std::size_t j = 0; j < m; ++j) y[i][j] = x[i][j] + y[i][j]; } Libraries Not Under Your Control 39 |4.2.3.17. --expt-relaxed-constexpr (-expt-relaxed-constexpr) Experimental0 码力 | 51 页 | 3.68 MB | 6 月前3 Bringing Existing Code to CUDA Using constexpr and std::pmrMemory System Memory GPU Memory 12 |“Unified Memory creates a pool of managed memory that is shared between the CPU and GPU, bridging the CPU-GPU divide. Managed memory is accessible to both the CPU i = 0; i < n; i++) y[i] += f(i); } 23 |“Unified Memory creates a pool of managed memory that is shared between the CPU and GPU, bridging the CPU-GPU divide. Managed memory is accessible to both the ++i) for (std::size_t j = 0; j < m; ++j) y[i][j] = x[i][j] + y[i][j]; } Libraries Not Under Your Control 39 |4.2.3.17. --expt-relaxed-constexpr (-expt-relaxed-constexpr) Experimental0 码力 | 51 页 | 3.68 MB | 6 月前3
 C++高性能并行编程与优化 -  课件 - 01 学 C++ 从 CMake 学起准备的参数可能对 MSVC 不适用。 • CMake 可以自动检测当前的编译器,需要添加哪些 flag 。比如 OpenMP ,只需要在 CMakeLists.txt 中指明 target_link_libraries(a.out OpenMP::OpenMP_CXX) 即可。 输出的可执行文件 输入的多个源文件 CMake 的命令行调用 • 读取当前目录的 CMakeLists.txt ,并在 build add_library(test SHARED source1.cpp source2.cpp) # 生成动态库 libtest.so • 动态库有很多坑,特别是 Windows 环境下,初学者自己创建库时,建议使用静态库。 • 但是他人提供的库,大多是作为动态库的,我们之后会讨论如何使用他人的库。 • 创建库以后,要在某个可执行文件中使用该库,只需要: • target_link_libraries(myexec 对他们同理: • target_include_directories(myapp PUBLIC /usr/include/eigen3) # 添加头文件搜索目录 • target_link_libraries(myapp PUBLIC hellolib) # 添加要链接的库 • target_add_definitions(myapp PUBLIC0 码力 | 32 页 | 11.40 MB | 1 年前3 C++高性能并行编程与优化 -  课件 - 01 学 C++ 从 CMake 学起准备的参数可能对 MSVC 不适用。 • CMake 可以自动检测当前的编译器,需要添加哪些 flag 。比如 OpenMP ,只需要在 CMakeLists.txt 中指明 target_link_libraries(a.out OpenMP::OpenMP_CXX) 即可。 输出的可执行文件 输入的多个源文件 CMake 的命令行调用 • 读取当前目录的 CMakeLists.txt ,并在 build add_library(test SHARED source1.cpp source2.cpp) # 生成动态库 libtest.so • 动态库有很多坑,特别是 Windows 环境下,初学者自己创建库时,建议使用静态库。 • 但是他人提供的库,大多是作为动态库的,我们之后会讨论如何使用他人的库。 • 创建库以后,要在某个可执行文件中使用该库,只需要: • target_link_libraries(myexec 对他们同理: • target_include_directories(myapp PUBLIC /usr/include/eigen3) # 添加头文件搜索目录 • target_link_libraries(myapp PUBLIC hellolib) # 添加要链接的库 • target_add_definitions(myapp PUBLIC0 码力 | 32 页 | 11.40 MB | 1 年前3
 NativeScript 101BSD+ JavaScript-Driven Native • Share code • Reuse existing skills/teams • Reuse existing libraries • Native UI (no WebView!) • Full access to device APIs • Immediate access to new OS features difference… Demo available in the app stores Rich, animated, “no compromise” native UI (with shared UI code) 1 Measurable native UI performanc e (“no jank”) 2 NativeScript 3.x == Maximum code community member Reuse existing native libraries 4 How does NativeScript work? Under the covers Generated at build time for OS & 3rd party native libraries NativeScript Android Example output:0 码力 | 90 页 | 40.11 MB | 1 年前3 NativeScript 101BSD+ JavaScript-Driven Native • Share code • Reuse existing skills/teams • Reuse existing libraries • Native UI (no WebView!) • Full access to device APIs • Immediate access to new OS features difference… Demo available in the app stores Rich, animated, “no compromise” native UI (with shared UI code) 1 Measurable native UI performanc e (“no jank”) 2 NativeScript 3.x == Maximum code community member Reuse existing native libraries 4 How does NativeScript work? Under the covers Generated at build time for OS & 3rd party native libraries NativeScript Android Example output:0 码力 | 90 页 | 40.11 MB | 1 年前3
 C++高性能并行编程与优化 -  课件 - 08 CUDA 开启的 GPU 编程fabsf , fminf , fmax f 。 https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#math-libraries 稍微快一些,但不完全精确的 __sinf • 两个下划线的 __sinf 是 GPU intrinstics ,精度相当于 GLSL 里的那种。 适合对精度要求不高,但有性能要求的图 是由多个流式多处理器( SM )组成的。每个 SM 可以处理一个或多个板块。 • SM 又由多个流式单处理器( SP )组成。每个 SP 可以处理一个或多个线程。 • 每个 SM 都有自己的一块共享内存( shared memory ),他的性质类似于 CPU 中的缓 存——和主存相比很小,但是很快,用于缓冲临时数据。还有点特殊的性质,我们稍后会 讲。 • 通常板块数量总是大于 SM 的数量,这时英伟达驱动就会在多个 样每个 for 循环内部都是没有数据依赖,从而是可以 并行的(对 CPU 而言是 SIMD 和指令级并行,虽 然 GPU 没有,但为了引出共享内存的概念我才这样 改)。 板块的共享内存( shared memory ) • 刚刚已经实现了无数据依赖可以并行的 for ,那么如何把 他真正变成并行的呢?这就是板块的作用了,我们可以把 刚刚的线程升级为板块,刚刚的 for 升级为线程,然后把0 码力 | 142 页 | 13.52 MB | 1 年前3 C++高性能并行编程与优化 -  课件 - 08 CUDA 开启的 GPU 编程fabsf , fminf , fmax f 。 https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#math-libraries 稍微快一些,但不完全精确的 __sinf • 两个下划线的 __sinf 是 GPU intrinstics ,精度相当于 GLSL 里的那种。 适合对精度要求不高,但有性能要求的图 是由多个流式多处理器( SM )组成的。每个 SM 可以处理一个或多个板块。 • SM 又由多个流式单处理器( SP )组成。每个 SP 可以处理一个或多个线程。 • 每个 SM 都有自己的一块共享内存( shared memory ),他的性质类似于 CPU 中的缓 存——和主存相比很小,但是很快,用于缓冲临时数据。还有点特殊的性质,我们稍后会 讲。 • 通常板块数量总是大于 SM 的数量,这时英伟达驱动就会在多个 样每个 for 循环内部都是没有数据依赖,从而是可以 并行的(对 CPU 而言是 SIMD 和指令级并行,虽 然 GPU 没有,但为了引出共享内存的概念我才这样 改)。 板块的共享内存( shared memory ) • 刚刚已经实现了无数据依赖可以并行的 for ,那么如何把 他真正变成并行的呢?这就是板块的作用了,我们可以把 刚刚的线程升级为板块,刚刚的 for 升级为线程,然后把0 码力 | 142 页 | 13.52 MB | 1 年前3
 C++20 STL Features: 1 Year of Development on GitHubDevelopment on GitHub Stephan T. Lavavej "Steh-fin Lah-wah-wade" Principal Software Engineer, Visual C++ Libraries stl@microsoft.com @StephanTLavavej2 Getting Started • Please hold your questions until the end Including: • atomic<shared_ptr C++20 STL Features: 1 Year of Development on GitHubDevelopment on GitHub Stephan T. Lavavej "Steh-fin Lah-wah-wade" Principal Software Engineer, Visual C++ Libraries stl@microsoft.com @StephanTLavavej2 Getting Started • Please hold your questions until the end Including: • atomic<shared_ptr- >, atomic - > • GH-601 by AdamBucior • - (bit_cast, rotating/counting, power-of-2) • Several PRs by barcharcraz • make_shared() For Arrays • GH-309 0 码力 | 45 页 | 702.09 KB | 6 月前3
 陈东 - 利用Rust重塑移动应用开发-230618code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages. - JNI JNI is an interface that allows Java to interact with code written id https://github.com/aaronisme/rcc_ios Rust Crypto Core Core business logic library , can be shared on different platform. - Signer - cryptography support - Blockchain Support - Publish each module0 码力 | 22 页 | 2.10 MB | 1 年前3 陈东 - 利用Rust重塑移动应用开发-230618code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages. - JNI JNI is an interface that allows Java to interact with code written id https://github.com/aaronisme/rcc_ios Rust Crypto Core Core business logic library , can be shared on different platform. - Signer - cryptography support - Blockchain Support - Publish each module0 码力 | 22 页 | 2.10 MB | 1 年前3
共 27 条
- 1
- 2
- 3













