Skip to content

Instantly share code, notes, and snippets.

View DavidPoliakoff's full-sized avatar

David Poliakoff DavidPoliakoff

  • Chicago Trading Company
  • Chicago
View GitHub Profile
@DavidPoliakoff
DavidPoliakoff / ToolLayer.cpp
Last active October 5, 2021 21:11
Writing the Tool Layer
function_pointer_that_takes_a_string begin_parallel_for_ptr;
function_pointer_that_takes_a_string end_parallel_for_ptr;
void initialize(std::string toolLibrary) {
void* handle = dlopen(toolLibrary);
begin_parallel_for_ptr = dlsym(handle, "kokkosp_begin_parallel_for");
end_parallel_for_ptr = dlsym(handle, "kokkosp_end_parallel_for");
}
void parallel_for(std::string label, boring_parallelism_stuff stuff) {
if(begin_parallel_for_ptr){
fence_kokkos(); // this is a _small_ lie
@DavidPoliakoff
DavidPoliakoff / kokkos.cpp
Created November 2, 2021 15:54
But why Kokkos Models?
#pragma omp parallel for
for(int i=0;i<lots;++i){
// insert psychics here
}
__global__ void cuda(){
int thread = threadIdx.x +
blockdim.x * blockIdx.x;
if(thread < lots){
// insert psychics here