avinsrid / ml-decoder Goto Github PK
View Code? Open in Web Editor NEWSignal Processing on Multicore Processors - Project
Signal Processing on Multicore Processors - Project
We pass P and Q matrices to GPU and declare the arguments in the kernel GPU as __global . Now in kernel, we save Q values into private memory(to see responseness), and noticed that Q's value is getting shuffled with someother junk.
kernel = """
__kernel void ml_decoder(__global cfloat_t* decoded, __global cfloat_t* r, __global cfloat_t* MatP, __global cfloat_t* MatQ, __global cfloat_t* MatAdjP, __global cfloat_t* QAMconstell, const int N,const int sizeQAM, const float frobNorm) {
/* Pick any two symbols from the constellation. this is x3 and x4 */
cfloat_t matq[2][2];
for (int i = 0; i< 2; i++)
{
for (int j = 0; j < 2; j++)
matq[i][j] = MatQ[i+j];
}
I am assigning matq[0][0] to the final output decoder[][] matrix and displaying it to see what it contains. We see it contains a junk value which is not in the Q matrix at all --> 1.18326625e-30-1.76872098j. Implies problem happens for P and Q matrices.
Output:
h is [[ 0.2254-0.9247j -0.3066+0.2423j]]
g is [[ 2.5303+1.9583j -0.9545+2.146j ]]
h bar is [[-0.56335605-0.57488396j -0.40634960-0.49558702j]]
g bar is [[-0.28645927-0.1266181j 3.60857801-1.62290385j]]
Noise matrix n1 is (0.3802+1.2968j)
Noise matrix n2 is (-1.5972+0.6096j)
Received matrix of 10 symbols is [[ 0.04987482 -0.70607322j]
[ 12.84596348+10.17234802j]]
P matrix is [[ 0.2254-0.9247j -0.3066+0.2423j]
[ 2.5303+1.9583j -0.9545+2.146j ]]
Q matrix is [[-0.56335605-0.57488396j -0.40634960-0.49558702j]
[-0.28645927-0.1266181j 3.60857801-1.62290385j]]
1.0585881
15.75374323
(|H|f)^2 + (|G|f)^2 = 16.81233133
hbar square + gbar square = 16.81233133
adjoint(P) = [[-0.9545+2.146j 0.3066-0.2423j]
[-2.5303-1.9583j 0.2254-0.9247j]]
adjoint(Q) = [[ 3.60857801-1.62290385j 0.40634960+0.49558702j]
[ 0.28645927+0.1266181j -0.56335605-0.57488396j]]
[[ 3.01954797+1.35365764j 0.00000000+0.j ]
[ 0.00000000+0.j 3.01954797+1.35365764j]]
[[-3.01954797-1.35365764j 0.00000000+0.j ]
[ 0.00000000+0.j -3.01954797-1.35365764j]]
Input = [[ 1.+1.j 1.-1.j]
[ 1.-1.j 1.+1.j]]
Decoded Result = [[ 1.-1.j 1.-1.j]
[ 1.+1.j 1.+1.j]]
[[ 1.18326625e-30-1.76872098j 0.00000000e+00+0.j ]
[ 0.00000000e+00+0.j 0.00000000e+00+0.j
On decoding, we are seeing that post decoding, s is only 0.25 - 0.50 times correct in comparison to the actual input.
However, if we see c(s), we see that the values don't even correspond to the decoded results. For eg.
Input = [[-1.-1.j -1.-1.j 1.-1.j 1.-1.j]
[ 1.+1.j 1.-1.j -1.-1.j -1.-1.j]]
Decoded Result = [[ 1.-2.j -1.+0.j -1.-1.j 0.+0.j]
[-1.-1.j 1.-1.j 1.-1.j -1.+1.j]]
blitzavi89@blitzavi89-Lenovo-Ideapad-Flex
What is 1 - 2j or 0+0j or -1+0j ?? These are not the inputs in first place. Second row corresponds to set of x3 and x4 values and atleast make sense.
Overload issue. should be an easy fix
The addition and multiplication operations in the code are for integers / floating point. We need to ensure the multiply/add are as per the format specified under pyopencl-complex.h
As per the paper, adj(P).P = 1/2 (H_fro^2 + G_fro^2).(Identity Matrix) but we are getting inconsistent values
We see that ceil and floor are not consistent with implementation.
When we manually run the ceil function on complex number we are getting perfect result, but when storing it back into Cs matrix, the values are coming out incorrectly as seen below,
[[-0.57899783+0.96499634j]
[ 1.21425543+0.32973875j]] -1.0 1.0
[[ 2.+0.j]
[ 1.+0.j]]
[[ 0.19299927+1.35099489j]
[ 1.60025398-0.0562598j ]] 1.0 2.0
[[ 7.+0.j]
[ 1.+0.j]]
1.0 and 2.0 are correct for real and imaginary of 0.19299927 + 1.35099489j. However we get the result as 7+0j which is wrong. Another observation is that for all values, imaginary value goes to 0.
This code seems incorrect in someway:
for i in range(N) :
r = np.array([[rx_sym[0,i]],[rx_sym[1,i]]])
mean_sqr = 0
temp= 100000 + 100000j
temp_index = 0
temp_s_bar = np.zeros((2,1)).astype(np.complex64)
temp_c_bar = np.zeros((2,1)).astype(np.complex64)
# Iterate through every combination of x3' and x4' from constellation of M symbols
for j in range(M) :
for k in range(M):
# s_bar is tranpose([j k])
s_bar = np.array([[constellation[j]],[constellation[k]]], np.complex64)
Cs = np.dot(((2_P_adj)/(HfGf_sqr)),(r - np.dot(Q,s_bar)))
# Take ceiling of x3'
print Cs,' ',((Cs[0,0].real)/(np.absolute(Cs[0,0].real)))_np.ceil(np.absolute(Cs[0,0].real)),' ', ((Cs[0,0].imag)/(np.absolute(Cs[0,0].imag)))_np.ceil(np.absolute(Cs[0,0].imag))
x3_real = ((Cs[0,0].real)/(np.absolute(Cs[0,0].real)))_np.ceil(np.absolute(Cs[0,0].real))
x3_complex = ((Cs[0,0].imag)/(np.absolute(Cs[0,0].imag)))_np.ceil(np.absolute(Cs[0,0].imag))
# Take floor of x4'
x4_real = ((Cs[1,0].real)/(np.absolute(Cs[1,0].real)))_np.floor(np.absolute(Cs[1,0].real))
x4_complex = ((Cs[1,0].imag)/(np.absolute(Cs[1,0].imag)))_np.floor(np.absolute(Cs[1,0].imag))
Cs[0,0] = x3_real + x3_complex_j
Cs[1,0] = x4_real + x4_complex_j
print Cs
mean_sqr = (LA.norm(r - np.dot(P,Cs) - np.dot(Q,s_bar), 'fro'))__2
#print mean_sqr
if mean_sqr < temp :
temp = mean_sqr
temp_s_bar = s_bar
temp_c_bar = Cs
#print "Least Sqr Metric = ", temp
result_decode[0,2_i] = temp_c_bar[0,0]
result_decode[0,(2_i)+1] = temp_c_bar[1,0]
result_decode[1,2_i] = temp_s_bar[0,0]
result_decode[1, (2*i)+1] = temp_s_bar[1,0]
Using pyopencl, we need to find out how to reproduce a complex number once we have extracted the real and imaginary parts, and manipulated them.
For eg, we need to extract the real and imaginary parts of the c_bar and accordingly apply floor and ceil operations to them on the absolute values.
Once we have those values, we should be able to reconstruct the new complex number.
Need to look for further options through pyopencl-complex.h to figure this one out.
I have written the GPU code. Need to further debug to find what part is giving the error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.