Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when local_id<32 , the code is different from local_id < 64; #24

Open
IaGumiLukaRin opened this issue Aug 28, 2019 · 0 comments
Open

when local_id<32 , the code is different from local_id < 64; #24

IaGumiLukaRin opened this issue Aug 28, 2019 · 0 comments

Comments

@IaGumiLukaRin
Copy link

Each SM splits its own blocks into Warps (currently with a maximum size of 32 threads).

All the threads in a warp executes concurrently on the resources of the SM ?

__syncthreads();
	if (should_add)
	{
		if (local_id < 128)
		{
			color_shared[local_id] += color_shared[local_id + 128];
			xy_shared[local_id] += xy_shared[local_id + 128];
			count_shared[local_id] += count_shared[local_id + 128];
		}
		__syncthreads();

		if (local_id < 64)
		{
			color_shared[local_id] += color_shared[local_id + 64];
			xy_shared[local_id] += xy_shared[local_id + 64];
			count_shared[local_id] += count_shared[local_id + 64];
		}
		__syncthreads();

		if (local_id < 32)
		{
			color_shared[local_id] += color_shared[local_id + 32];
			color_shared[local_id] += color_shared[local_id + 16];
			color_shared[local_id] += color_shared[local_id + 8];
			color_shared[local_id] += color_shared[local_id + 4];
			color_shared[local_id] += color_shared[local_id + 2];
			color_shared[local_id] += color_shared[local_id + 1];

			xy_shared[local_id] += xy_shared[local_id + 32];
			xy_shared[local_id] += xy_shared[local_id + 16];
			xy_shared[local_id] += xy_shared[local_id + 8];
			xy_shared[local_id] += xy_shared[local_id + 4];
			xy_shared[local_id] += xy_shared[local_id + 2];
			xy_shared[local_id] += xy_shared[local_id + 1];

			count_shared[local_id] += count_shared[local_id + 32];
			count_shared[local_id] += count_shared[local_id + 16];
			count_shared[local_id] += count_shared[local_id + 8];
			count_shared[local_id] += count_shared[local_id + 4];
			count_shared[local_id] += count_shared[local_id + 2];
			count_shared[local_id] += count_shared[local_id + 1];
		}
	}
__syncthreads();
__syncthreads();
		if (local_id < 32)
		{
			color_shared[local_id] += color_shared[local_id + 32];
			xy_shared[local_id] += xy_shared[local_id + 32];
			count_shared[local_id] += count_shared[local_id + 32];
		}
__syncthreads();
if (local_id < 16)
		{
			color_shared[local_id] += color_shared[local_id + 16];
			xy_shared[local_id] += xy_shared[local_id + 16];
			count_shared[local_id] += count_shared[local_id + 16];
		}
__syncthreads();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant