This file contains hidden or 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
#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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
extern "C" void kokkosp_begin_parallel_for(const char* name, const uint32_t devID, uint64_t* kID){ | |
if(name matches a regex){ | |
jonathans_api_wrapper_start(); | |
*kID = 1; | |
} | |
} | |
extern "C" void kokkosp_end_parallel_for(uint64_t kID){ | |
if(kID==1){ | |
jonathans_api_wrapper_stop(); | |
} |
This file contains hidden or 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
Kokkos::TeamPolicy<Kokkos::Cuda> execution_policy(total_amount_of_work, | |
outer_parallelism_batch_size, | |
inner_parallelism_batch_size); | |
Kokkos::parallel_for("implement_psychics", execution_policy, | |
KOKKOS_LAMBDA (team_member outer_handle) { | |
// some outer level work | |
double sum = psychics; | |
parallel_reduce (ThreadVectorRange (outer_handle, loop_count), | |
[=] (int& i, Scalar& lsum) { |
This file contains hidden or 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
int MPI_Send( /* Args */ ){ | |
// typical MPI code | |
} |
This file contains hidden or 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
struct gotcha_binding_t mpi_wrappers[] = { | |
{ "MPI_Init", mpi_init_wrapper, &orig_mpi_init_handle }, | |
// other wrappers as desired | |
}; | |
static int mpi_init_wrapper(int* argc, char*** argv ) | |
{ | |
typeof(&puts) orig_init = gotcha_get_wrappee(orig_mpi_init_handle); | |
/** do tool_things */ | |
return orig_init(str); |
This file contains hidden or 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
int MPI_Send(const void *buf, int count, | |
MPI_Datatype datatype, int dest, int tag, | |
MPI_Comm comm){ | |
// MPI Things | |
} |
This file contains hidden or 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
bash-4.2$ ./autogen.sh | |
Running autoreconf -i ... | |
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `config'. | |
libtoolize: copying file `config/ltmain.sh' | |
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. | |
libtoolize: copying file `m4/libtool.m4' | |
libtoolize: copying file `m4/ltoptions.m4' | |
libtoolize: copying file `m4/ltsugar.m4' | |
libtoolize: copying file `m4/ltversion.m4' | |
libtoolize: copying file `m4/lt~obsolete.m4' |
This file contains hidden or 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
ssize_t (*orig_read)(int fildes, void *buf, size_t nbyte); | |
ssize_t read_wrapper(int fildes, void* buf, size_t nbyte){ | |
TAU_REGISTER_CONTEXT_EVENT(event, "Bytes read"); | |
TAU_CONTEXT_EVENT(event, nbyte); | |
return orig_read(fildes, buf, nbyte); | |
} | |
struct gotcha_binding_t wrap_actions[] = { | |
{ "read", read_wrapper, &orig_read } | |
}; |
NewerOlder