Posts

sorting - CUDA - How to make thread in kernel wait for it's children -

i'm trying implement simple merge sort using cuda recursive (for cm > 35) technology, can not find way tell parent thread launch it's children concurrently , wait it's children computation, since cudaeventsynchronize() , cudastreamsynchronize() host only. __syncthread() not archive desired effect, since parent's next line should executed after it's children has completed computation. __global__ void simple_mergesort(int* data,int *dataaux,int begin,int end, int depth){ int middle = (end+begin)/2; int i0 = begin; int i1 = middle; int index; int n = end-begin; cudastream_t s,s1; //if we're deep or there few elements left, use insertion sort... if( depth >= max_depth || end-begin <= insertion_sort ){ selection_sort( data, begin, end ); return; } if(n < 2){ return; } // launches new block sort left part. cudastreamcreatewithflags(&s,cudadevicescheduleb...

vector - Determine coplanar (or collinear) points in higher dimensions with Java -

in java, best way determine if point (of have many) given in 6 dimensions lies on same plane other points in 6-dimensional space? it's clear how in 2d , 3d, far know of concepts such cross product, etc, not generalise higher dimensions (or specific few). it helpful find way answer same question points on lines in 6d. more general, have given higher dimensional point cloud , want determine if of these points lie on same plane. in n-dimensional space, point lies in same hyperplane n (non-degenerate) others, if volume of simplex, formed these (n+1) points, zero. simplex volume calculated through determinant |1 x1 y1 z1 ...| |1 x2 y2 z2 ...| v = 1/n! |1 x3 y3 z3 ...| |1 x4 y4 z4 ...| |..............| note formula corresponds cross product check collinearity in 2d case, mixed product check coplanarity in 3d case etc

matlab - Accelerometer with FFT - strange output -

Image
after reading lot of research , works on subject still have got problems applying fft accelerometer data. of code taken official matlab example: fft 1 dimension . after more reading i've found question: fft , accelerometer data: why getting output? there suggestion use windowing. after more reading i've added hamming window code. my data looks on plot: and code using fft: fs = 1/0.02; %0.02 comes picking sample each 20ms m = size(data,1); w = hanning(m); yw = w.*data; n = pow2(nextpow2(yw)); y = fft(yw,size(n,1)); f = (0:size(n,1)-1)*(fs/size(n,1)); power = y.*conj(y)/size(n,1); figure plot(f,power) the problem plot code looks that: can tell me wrong code? honest i'd excepted better (something this: http://imgur.com/wgs43 ) that's why asking question. edit: data can found here: https://dl.dropboxusercontent.com/u/58774274/exp.txt your fs 50 highest frequency in data can fs/2 = 25hz . see if code helps. fid = fopen('1.txt','r...

Best way to pass name from HTML file upload to PSQL statement using Ruby? -

for example: <form action="/new/details"> <input type="file" name="upload" accept="file_extension"> <input type="submit"> </form> 'upload' needs inserted psql statement using ruby db.exec("copy details '?????' delimiter ',' csv;")

file - Tilde (~/) not working on if then statement in Shell script -

this question has answer here: tilde expansion in environment variable 2 answers i have following script file=${file:-letsdump.sh} checkfile="~/mysql_backup/$file" if [ -e "$checkfile" ]; mv ~/mysql_backup/$file ~/mysql_backup/$file-bak-$(date +%d%m%y_%h%m).bak else echo 'file doesnt exist' fi i know file there, thinking ~/ ? it never finds file double quotes (really, quotes) prevent ~ being expanded. use instead: checkfile=~/mysql_backup/"$file" ...or, better, use $home in scripts, , consider ~ facility interactive/human use only.

amazon web services - AWS Elastic Load Balancer on a Single Instance containing two instance of application running on different ports -

i have 2 application on single ec2 instance running on ports 8090 , 8091. want use single elb these 2 instances , both applications same. but same elb port cant map different listeners ie 8080 -> 8090 8080 -> 8091 want whenever hit elb either 1 of 2 application in 8090 or 8091 should invoked. elb doesn't support mapping specific host. elb maps port port backend instances. use 2 elbs dns round robin? option setup haproxy roll own solution load balancing.

Is it possible to run MapReduce locally, without HDFS and Hadoop cluster? -

given develop mapreduce tasks in windows system , before moving them hdfs cluster run mapreduce locally. want check how work mapper logic, inputsplits, input/output formats etc. possible? hadoop runs in 3 modes. 1.local mode 2.psuedo mode 3.distributed mode. the 1 looking local mode. can debug mapreduce code eclipse before run in 2 or 3 modes. this step step guide run application in local mode helps lot debug application. hope helps!