This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// an extract from a REPL session | |
val A = CuMatrix.fromDense(DenseMatrix((1.0f, 1.0f, 2.0f, 1.0f), (1.0f, 2.0f, 1.0f, -2.0f), (3.0f, -1.0f, 3.0f, -2.0f), (-2.0f, 3.0f, -1.0f, 1.0f))) | |
val N = 4 | |
val Aarray = jcuda.Pointer.to(A.offsetPointer) // this is the one I'm most uncertain about | |
val P = CuMatrix.create[Int](N, 1) // but I'm not sure about those 2 either | |
val info = CuMatrix.create[Int](N,1) | |
JCublas2.cublasSgetrfBatched(handle, N, Aarray, N, P.offsetPointer, info.offsetPointer, 1) // this call returns success (0), | |
// but A is zeroed-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <cstdlib> | |
#include <cuda_runtime.h> | |
#include <cublas_v2.h> | |
#define cudacall(call) \ | |
do \ | |
{ \ | |
cudaError_t err = (call); \ | |
if(cudaSuccess != err) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def LU(A: CuMatrix[Float])(implicit handle: cublasHandle): CuMatrix[Float]= { | |
if (A.rows != A.cols) { | |
println("Matrix has to be square.") | |
return A | |
} | |
val d_A = CuMatrix.create[Float](A.rows, A.cols) | |
d_A := A | |
val P = CuMatrix.create[Int](d_A.rows, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bidiagonalization with removed calls to my own kernels, inlined functions for | |
* calculating the householder vectors and a few other minor changes. | |
*/ | |
def bidiagDoubleInline(A: CuMatrix[Double])(implicit handle: cublasHandle): (CuMatrix[Double], CuMatrix[Double], CuMatrix[Double]) = { | |
if (A.rows < A.cols) { | |
println("Number of rows of matrix A cannot be smaller than the number of columns.") | |
return (null, A, null) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// przyklad ma na celu zobrazowanie czym rozni sie multiple dispatch od single dispatch. | |
public class DispatchTest { | |
public static void main(String[] args) { | |
Foo foo = new Bar(); // typ statyczny: Foo, typ runtime'owy: Bar | |
A a = new B(); // typ statyczny: A, typ runtime'owy: B | |
foo.fooMethod(a); // wolamy tak, by dac szanse kompilatorowi sie wykazac (dwa razy inny typ | |
// dynamiczny i statyczny) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Przykład w Scali, bo to jedyny znany mi język, który udostępnia i dziedziczenie, i typeclassy. | |
* Jest prosty, więc nie trzeba znać ani troche Scali :) | |
* | |
* tl;dr Typeclassy są super, ale alternatywą są interfejsy, a nie przeciążanie. | |
*/ | |
// sytuacja trochę jak z Accelerate'em: biblioteka do algebry liniowej, czyli udostępnia jakiś typ macierzowy (A jest parametrem typu): | |
class Matrix[A](values: Array[A], rows: Int, cols: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewsReceiver extends _FinancialNewsReceiverDisp { | |
private static final long serialVersionUID = -3538248252658050588L; | |
public static HashMap<CurrencyPair, Float> exchangeRates = new HashMap<>(); | |
public static HashMap<Currency, Float> interestRates = new HashMap<>(); | |
@Override | |
public void interestRate(float rate, Currency curr, Current __current) { | |
interestRates.put(curr, rate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sources.list file for arm cross-development under amd64 | |
#deb [arch=amd64] cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted | |
deb [arch=armhf] http://ports.ubuntu.com/ trusty main restricted universe multiverse | |
deb [arch=armhf] http://ports.ubuntu.com/ trusty-security main restricted universe multiverse | |
deb [arch=armhf] http://ports.ubuntu.com/ trusty-updates main restricted universe multiverse | |
deb [arch=armhf] http://ports.ubuntu.com/ trusty-backports main restricted universe multiverse | |
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to | |
# newer versions of the distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disclaimer: work-in-progress-kind-of-thing, really more of a dockerfile-became-shellscript | |
# Installs emulated arm ghc on amd64 box | |
# It assumes you're running Ubuntu 14.04 (Trusty) | |
# Oh btw -- run with sudo | |
# from Alexey Raga's dockerfile (to stop apt from asking you for a "yes"): | |
export DEBIAN_FRONTEND=noninteractive | |
export OPTS_APT="-y --force-yes --no-install-recommends" | |
apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by moczur on 10/19/15. | |
*/ | |
import akka.event.LoggingReceive | |
import akka.actor._ | |
import scala.concurrent.duration._ | |
import scala.util.Random | |
import language.postfixOps |
OlderNewer