Reasons and solutions for GPU CUDA running speed not to increase but to decrease when using shared memory

I wrote several operators for adding two images and image filtering, respectively using shared memory for optimization. #include <stdio.h> #include <cuda_runtime.h> #include “helper_cuda.h” #include “helper_timer.h” #define BLOCKX 32 #define BLOCKY 32 #define BLOCK_SIZE 1024 #define PADDING 2 __global__ void filter5x5(float* in, float* out, int nW, int nH) {<!– –> // Thread index —> Global memory […]

The use of C++ smart pointers: the use of shared_ptr, weak_ptr, unique_ptr, use case description.

Directory of series articles Contents of this chapter: (1) Introduction to shared_ptr, weak_ptr, unique_ptr (2) Memory leak caused by using share_ptr alone (3) Combined use of shared_ptr and weak_ptr Article directory Table of Contents of Series Articles Preface 1. Use of shared_ptr, weak_ptr, unique_ptr 1.1 shared_ptr 1.2 weak_ptr 1. Creation of weak_ptr pointer 2. Member […]

(StateFlow & ShareFlow) VS (Flow & LiveData)

Table of Contents data flow General process Switch thread StateFlow & ShareFlow StateFlow Build StateFlow &ShareFlow In the previous articles on Flow, collect function analysis and imitation of Flow builder to create data flow articles, we explored the simple use of flow and its simple principles. However, during the production process, we often borrow these […]

Write static library (ar, package), write dynamic library (sharing principle, -fPIC, -shared), install static library (system path (library name)/specified path (-I, -L option)), install dynamic library ( ldd,-static, tells the loader the path to search

Table of Contents How to write a library static library Introduction — static library principle form static library introduce ar Options Create static library Add files to existing static library After we have a library, how should we give it to others? dynamic library The difference between static library and dynamic library linking static library […]

Android-SharedPreferences detailed usage

Directory SharedPreferences 1. Introduction 2. Understand 1 data storage 2 Data reading 3 common methods 3.1 getSharedPreferences() 3.2 edit() 3.4 remove() remove data 3.5 clear() clears data 3.6 commit() submits and saves data 3. Basic use 1 an example 4. Monitoring 5. Performance analysis 6. Points of attention during use 1 Get the SharedPreferences object […]

C++ concurrent programming practice – 03. Shared data

Article directory Share data Shared data issues Use mutex Protect shared data Conditional competition between interfaces Deadlock and its solution std::unique_lock – flexible lock Passing of mutexes in different domains Lock granularity Ways to protect shared data Initialization process to protect shared data Protect data structures that are updated infrequently Nested lock Share data Shared […]

Usage and cases of Web Woeker and Shared Worker

Article directory 1 Introduction 2. Introduction to Web Worker 3. Instructions for use and compatibility 3.1. Instructions for use 3.2. Compatibility 4. Use Web Worker 4.1. Create Web Worker 4.2. Communicate with the main thread 4.3. Terminate Web Worker 4.4. Monitor error messages 5. Use Shared Worker 4.5. Debugging Shared Worker 6. Some pitfalls in […]

[Linux process communication] shared memory

Please like introduce Detailed explanation of shared memory What is shared memory? How shared memory works Why use shared memory? Advantages of shared memory Limitations of shared memory Shared memory and process communication Shared memory compared to other communication methods some commands Order ipcs ipcrm system call Real machine demonstration in conclusion Introduction In computer […]

Operating System – Experiment 2: Process Communication (Pipelines and Shared Memory)

Operating system experiment report Experiment 2: Process Communication (1) – Pipes and Shared Memory 1. Purpose of the experiment Be familiar with and master the pipeline mechanism and implement inter-process communication; Be familiar with and master the shared memory mechanism and implement inter-process communication. 2. Experimental content and steps 2.1 Task 1 Read the above […]