2017-02-14 10 views
0

Я пытаюсь оценить точки в большом кусочно-полином, который получается из кубического сплайна. Я пытаюсь сделать это на GPU, и я сталкиваюсь с ограничениями памяти.Последовательная оценка кусочных полиномов на GPU

Как таковой, я хотел бы оценить кусочный многочлен в партиях.

Оригинальный код:

Y = some_matrix_of_data_values ; 
X = some_vector_of_data_sites ; 
pp = spline(X, Y) ; % get the piecewise polynomial form of the cubic spline. The resulting structure is very large. 

for t = 1: big_number 
    hcurrent = ppval(pp,t); %evaluate the piecewise polynomial at t 
    y(t) = sum(x(t:t+M-1).*hcurrent,1) ; % do some operation of the interpolated value. Most likely not relevant to this question. 
end 

vectorised, надеюсь на пути к GPU пакетной обработки:

Y = some_matrix_of_data_values ; 
X = some_vector_of_data_sites ; 
pp = spline(X, Y) ; % get the piecewise polynomial form of the cubic spline. Resulting structure is very large. 
batchSize = 1024 ; 

for tt = 1: batchSize: big_number 
    if tt > big_number - batchSize % snatch up any remaining values at the end of the loop, and calculate those as well 
     batchSize = big_number - tt ; 
    end    
    hcurrent = ppval(pp ,(tt:tt+batchSize-1)) ; %evaluate pp at a couple of data sites  

    ind = bsxfun(@plus, 1:M, (tt-1:1:tt+batchSize-2).')) ; %make an index matrix to help with next calculation. Most likely not relevant to this question. 
    y(tt:tt+batchSize-1) = sum(x(ind).*hcurrent' , 2) ; % do some calculation, but now we have done it in batches! 
end 

В переработанном коде, кусочно-полиномиальная оценивается на нескольких сайтах данных, поэтому мы по крайней мере, на нашем пути туда. Кусочный многочлен pp слишком велик для хранения на графическом процессоре, есть ли способ разбить его на пакетную обработку?

ответ

0

Полезная тема here, в которой вместо этого говорится о расслоении кусочно-полиномиальной оценки. Это решение можно портировать на GPU для пакетной обработки.

Смежные вопросы