Skip to content

Instantly share code, notes, and snippets.

View leopoldcambier's full-sized avatar
👨‍💻
Computing

Léopold Cambier leopoldcambier

👨‍💻
Computing
View GitHub Profile
@leopoldcambier
leopoldcambier / myblas.c
Created June 18, 2020 18:19
Wrapper of MKL for Legion
#include <mkl_blas.h>
#include <mkl_lapack.h>
/**
* Build like
*
* gcc myblas.c -o myblas.so -shared -fPIC -m64 -I${MKLROOT}/include -shared -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
*/
void my_dgemm(char* transa, char* transb, int* m, int* n, int* k, double* alpha,
@leopoldcambier
leopoldcambier / pdgemm.cpp
Last active March 11, 2021 23:31
Example of Scalapack GEMM
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <algorithm>
#include <cassert>
#include "mpi.h"
/**
* Compile with something like
@leopoldcambier
leopoldcambier / mpi_contiguous.cpp
Created April 7, 2020 21:53
Creation of a contiguous type in MPI
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
@leopoldcambier
leopoldcambier / template.cpp
Last active September 2, 2023 23:40
Chaining functions using C++ templates
#include<tuple>
#include<iostream>
#include<string>
// Returns the Tin of the first element
template<typename... Trs>
struct Tin_list
{
using type = typename std::tuple_element<0, std::tuple<Trs...>>::type::Tin_type;
};
@leopoldcambier
leopoldcambier / template.cpp
Created April 3, 2020 18:25
Chaining functions using C++ template
#include<tuple>
#include<iostream>
#include<string>
template<typename Tin, typename Tout>
struct transformer {
Tout transform(Tin tin) {
std::cout << "Hi!\n";
return tin + 1;
}
@leopoldcambier
leopoldcambier / example_pdpotrf.cpp
Last active August 7, 2023 01:56
Scalapack pdpotrf example, C++
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <algorithm>
#include <cassert>
#include "mpi.h"
/**
* Compile with something like