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
void parallelMultiply1D(Matrix1D *A, Matrix1D *B, Matrix1D *C, int n) { | |
omp_set_num_threads(4); | |
#pragma omp parallel for | |
for (int i = 0; i < n; ++i) { | |
double *Arow = &A->matrix[i * n]; | |
double *Crow = &C->matrix[i * n]; | |
for (int j = 0; j < n; ++j) { | |
double sum = 0; |
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
void multiply1DMatrixIKJ(Matrix1D *A, Matrix1D *B, Matrix1D *C, int n) { | |
for (int i = 0; i < n; ++i) { | |
double *Arow = &A->matrix[i * n]; | |
double *Crow = &C->matrix[i * n]; | |
for (int k = 0; k < n; ++k) { | |
double temp = *(Arow + k); | |
double *Brow = &B->matrix[k * n]; | |
for (int j = 0; j < n; ++j) |
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
void blasL1(Matrix1D *A, Matrix1D *B, Matrix1D *C, int n) { | |
double *Cmat = C->matrix; | |
double *Amat = A->matrix; | |
double *Bmat = B->matrix; | |
double *Arv, *Crv; | |
omp_set_num_threads(4); | |
#pragma omp parallel for | |
for (int i = 0; i < n; ++i) { |
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
void blasL3(Matrix1D *A, Matrix1D *B, Matrix1D *C, int n) { | |
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n, 1, A->matrix, n, B->matrix, n, 0, C->matrix, n); | |
} |
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
import ballerina.net.http; | |
import ballerina.config; | |
const int httpPort = initPort(); | |
@http:configuration {port:httpPort} | |
service<http> echo { | |
@http:resourceConfig { | |
path:"/" |
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
import ballerina.net.http; | |
import ballerina.config; | |
endpoint<http:Service> passthroughEP { | |
port:9090 | |
} | |
endpoint<http:Service> backendEP { | |
port: getBackendPort() | |
} |
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
import ballerina/http; | |
import ballerina/log; | |
endpoint http:Client cachingEP { | |
url: "http://localhost:8080", | |
cache: { isShared: true } | |
}; | |
@http:ServiceConfig { basePath: "/cache" } | |
service<http:Service> cachingService bind { port: 9090 } { |
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
import ballerina/http; | |
endpoint http:Client cachingEP { | |
url: "https://jigsaw.w3.org/", | |
cache: { | |
isShared: true | |
} | |
}; | |
@http:ServiceConfig { |
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
import ballerina/config; | |
import ballerina/http; | |
import ballerina/log; | |
listener http:Listener echoListener = new http:Listener(config:getAsInt("echo.httpPort")); | |
listener http:Listener echoSecureListener = new http:Listener(config:getAsInt("echo.httpsPort"), config = { | |
secureSocket: { | |
keyStore: { | |
path: config:getAsString("echo.keystore.path"), |
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
[echo] | |
httpPort=9090 | |
httpsPort=9095 | |
keystore.path="${ballerina.home}/bre/security/ballerinaKeystore.p12" | |
keystore.password="ballerina" |