Skip to content
Snippets Groups Projects
Commit 5dec0808 authored by Niamh Nikali's avatar Niamh Nikali
Browse files

Merge branch 'api' into 'master'

Create external API for elgamal and exp cryptops

See merge request elixxir/gpumaths!15
parents 7168c60a b2d0ff49
No related branches found
No related tags found
No related merge requests found
...@@ -18,10 +18,15 @@ pick: ...@@ -18,10 +18,15 @@ pick:
@echo @echo
clean: clean:
rm -f libpowmosm*.so rm -f libpowmo*.so
devinstall:
mkdir -p ../../lib
mv libpowmo*.so ../../lib
install: install:
mv libpowmosm*.so ../../lib mkdir -p /opt/elixxir/lib
mv libpowmo*.so /opt/elixxir/lib
kepler: kepler:
nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_30 powm_odd.cu -o libpowmosm40.so -lgmp nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_30 powm_odd.cu -o libpowmosm40.so -lgmp
...@@ -36,6 +41,8 @@ volta: ...@@ -36,6 +41,8 @@ volta:
nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_70 powm_odd.cu -o libpowmosm70.so -lgmp nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_70 powm_odd.cu -o libpowmosm70.so -lgmp
turing: turing:
nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_75 powm_odd.cu -o libpowmosm75.so -lgmp -g nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_75 powm_odd.cu -o libpowmosm75.so -lgmp
turingdebug:
nvcc --compiler-options '-fPIC' --shared $(INC) $(LIB) -I../../cgbn-master/include -arch=sm_75 powm_odd.cu -o libpowmosm75.so -lgmp -g -DTRACE
all: kepler maxwell pascal volta turing
This diff is collapsed.
...@@ -33,25 +33,17 @@ enum kernel { ...@@ -33,25 +33,17 @@ enum kernel {
}; };
// Prepare a kernel run // Prepare a kernel run
const char* upload(const uint32_t instance_count, void *stream, size_t inputsUploadSize, size_t constantsUploadSize, size_t outputsDownloadSize); const char* upload(const uint32_t instance_count, void *stream, enum kernel whichToRun);
// Enqueue a kernel run // Enqueue a kernel run
const char* run(void *stream, enum kernel whichToRun); const char* run(void *stream);
// Enqueue download from a previous kernel launch // Enqueue download from a previous kernel launch
const char* download(void *stream); const char* download(void *stream);
// Wait for a results download to finish // Wait for a results download to finish
struct return_data* getResults(void *stream); const char* getResults(void *stream);
struct streamCreateInfo { struct streamCreateInfo {
// How many instances can be invoked in a kernel launch? // How much memory is available for the stream to use?
size_t capacity; size_t capacity;
// What's the size in bytes of the entire input buffer?
// (assumed to be linear in size with number of inputs)
size_t inputsCapacity;
// What's the size in bytes of the entire output buffer?
// (assumed to be linear in size with number of inputs)
size_t outputsCapacity;
// What's the size in bytes of the entire constants buffer?
size_t constantsCapacity;
}; };
...@@ -64,7 +56,7 @@ const char* destroyStream(void *destroyee); ...@@ -64,7 +56,7 @@ const char* destroyStream(void *destroyee);
// Get a pointer to the CPU inputs buffer from a stream // Get a pointer to the CPU inputs buffer from a stream
// Overwrite this memory with inputs before enqueueing an upload // Overwrite this memory with inputs before enqueueing an upload
void* getCpuInputs(void* stream); void* getCpuInputs(void* stream, enum kernel op);
// Get a pointer to the CPU outputs buffer from a stream // Get a pointer to the CPU outputs buffer from a stream
// Read outputs from this memory after calling getResults to synchronize the event // Read outputs from this memory after calling getResults to synchronize the event
...@@ -74,11 +66,12 @@ void* getCpuOutputs(void* stream); ...@@ -74,11 +66,12 @@ void* getCpuOutputs(void* stream);
// Overwrite this memory with constants before enqueueing an upload // Overwrite this memory with constants before enqueueing an upload
void* getCpuConstants(void* stream); void* getCpuConstants(void* stream);
// Call this after execution has completed to write out profile information to the disk // Get memory size required for a certain op's constants buffer
const char* stopProfiling(); size_t getConstantsSize(enum kernel op);
// Get memory size required for a certain op's inputs buffer
// Calling this is optional if you profile from the start of execution. size_t getInputSize(enum kernel op);
const char* startProfiling(); // Get memory size required for a certain op's outputs buffer
size_t getOutputSize(enum kernel op);
// If using the newer profiler, use this instead when kernels have finished // If using the newer profiler, use this instead when kernels have finished
// running to signal the profiler that execution has finished. // running to signal the profiler that execution has finished.
......
...@@ -130,3 +130,10 @@ void random_words(uint32_t *x, uint32_t count) { ...@@ -130,3 +130,10 @@ void random_words(uint32_t *x, uint32_t count) {
for(index=0;index<count;index++) for(index=0;index<count;index++)
x[index]=random_word(); x[index]=random_word();
} }
void debugPrint(const char* s) {
#ifdef TRACE
printf("%s\n", s);
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment