Click here to Skip to main content
15,886,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
jimNLX11-Apr-18 9:03
jimNLX11-Apr-18 9:03 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
leon de boer17-Apr-18 21:45
leon de boer17-Apr-18 21:45 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
jimNLX18-Apr-18 3:49
jimNLX18-Apr-18 3:49 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
leon de boer18-Apr-18 15:27
leon de boer18-Apr-18 15:27 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
jimNLX9-May-18 9:18
jimNLX9-May-18 9:18 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
leon de boer9-May-18 16:11
leon de boer9-May-18 16:11 
GeneralRe: porting _beginthreadex from VS2005 to VS2017 Pin
jimNLX11-May-18 6:23
jimNLX11-May-18 6:23 
QuestionOpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349219-Mar-18 19:19
User 1370349219-Mar-18 19:19 
Hello all

I am performing multiplication between two square bit-matrices using a specific formula (not the dot product of row/col, I will describe it below). My implementation works correctly but it blows up when I attempt to do tiling in the local memory. Even though I understand the principles behind it (i.e. putting some of my data in local arrays, then using barriers to synchronize my work-items), I keep getting the wrong results.

This is an example of how I setup the matrices:
C++
int N = 256; // number of bits in a row/col (or any number that is evenly divisible by 64)
unsigned long long A = new unsigned long long[n*n/64]; // stores bits in 64-bit integers
unsigned long long B = new unsigned long long[n*n/64]; // for example, one row consists of 256 bits and uses 4x64-bit integers to store them
int C  = new int[n*n];
This is the actual formula:
Row i of matrix A is XORed with row j of matrix B. Yes, it is a row to row operation. Then, I count the number of 1s and assign the sum to C[i][j].

This is how I launch the kernel:
C++
const size_t global[2] = { n, n };
clEnqueueNDRangeKernel(queue, kernel, 2, NULL, global, 0, 0, NULL, &event);
This is the actual kernel which works correctly:
C++
__kernel void BitProduct(const int N, const __global ulong* A, const __global ulong* B, __global int* C)
    {
    	const int i = get_global_id(0);
    	const int j = get_global_id(1);
 
    	ulong sum = 0;
 
    	for (int k = 0;k < N/64;k++)
    		sum += popcount( A[ i*(N/64) + k ] ^ B[ j*(N/64) + k ] );
 
    	C[ i * N + j ] = (int) sum;
    }

AnswerRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer19-Mar-18 23:47
leon de boer19-Mar-18 23:47 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349220-Mar-18 1:02
User 1370349220-Mar-18 1:02 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer20-Mar-18 3:12
leon de boer20-Mar-18 3:12 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349220-Mar-18 10:09
User 1370349220-Mar-18 10:09 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer20-Mar-18 15:27
leon de boer20-Mar-18 15:27 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349221-Mar-18 3:50
User 1370349221-Mar-18 3:50 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer21-Mar-18 4:25
leon de boer21-Mar-18 4:25 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349221-Mar-18 7:00
User 1370349221-Mar-18 7:00 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer21-Mar-18 16:12
leon de boer21-Mar-18 16:12 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 137034921-Apr-18 18:05
User 137034921-Apr-18 18:05 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
leon de boer2-Apr-18 18:56
leon de boer2-Apr-18 18:56 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
User 1370349220-Mar-18 9:07
User 1370349220-Mar-18 9:07 
GeneralRe: OpenCL bit-matrix multiplication (implementing tiling in local memory) Pin
Victor Nijegorodov20-Mar-18 9:18
Victor Nijegorodov20-Mar-18 9:18 
QuestionHow to read MS EXCEL workbook in Linux using C++ Pin
Member 179075719-Mar-18 5:55
Member 179075719-Mar-18 5:55 
AnswerRe: How to read MS EXCEL workbook in Linux using C++ Pin
Randor 19-Mar-18 7:11
professional Randor 19-Mar-18 7:11 
AnswerRe: How to read MS EXCEL workbook in Linux using C++ Pin
Victor Nijegorodov19-Mar-18 7:19
Victor Nijegorodov19-Mar-18 7:19 
QuestionCompiling MPI with VS2017 Linux Pin
Kenneth Haugland18-Mar-18 11:10
mvaKenneth Haugland18-Mar-18 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.