-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added backend support to python bindings. It is untested. * made requested changes to first part of project * implemented all critical bindings. Started writing tests but they are not all passing yet. * fixed test 2 * reverted dGrid back to using Neon::int32_3d instead of 3 integers * used max's fix for py_neon.Index_3d
- Loading branch information
1 parent
25536af
commit ca3d9ac
Showing
41 changed files
with
2,622 additions
and
364 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
#include <mutex> | ||
|
||
class AllocationCounter { | ||
public: | ||
// Static methods to manage allocations and deallocations | ||
static void Allocation(); | ||
static void Deallocation(); | ||
|
||
// Static method to get the current allocation count | ||
static int GetAllocationCount(); | ||
|
||
private: | ||
// Private constructor to prevent instantiation | ||
AllocationCounter() = default; | ||
|
||
// Private static method to get the singleton instance | ||
static AllocationCounter& GetInstance(); | ||
|
||
// Private static variable to hold the allocation count | ||
static int allocationCount; | ||
|
||
// Mutex to protect access to allocationCount | ||
static std::mutex allocationMutex; | ||
}; | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
#include <cstdint> | ||
#include "AllocationCounter.h" | ||
|
||
/** | ||
* Get Counter | ||
*/ | ||
extern "C" auto get_allocation_counter() | ||
-> int; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#pragma once | ||
#include <cstdint> | ||
#include "Neon/domain/Grids.h" | ||
|
||
/** | ||
* Initialize a new grid object on the heap. | ||
* NOTE: some parameters are still not exposed | ||
*/ /* TODOMATT fix the constructor to have correct arguments */ | ||
extern "C" auto bGrid_new( | ||
uint64_t& handle, | ||
Neon::Backend* backendPtr, | ||
Neon::index_3d dim) | ||
-> int; | ||
|
||
/** | ||
* Delete a grid object on the heap. | ||
*/ | ||
extern "C" auto bGrid_delete( | ||
uint64_t& handle) | ||
-> int; | ||
|
||
/** | ||
* Generates a new field object on the heap. | ||
*/ | ||
extern "C" auto bGrid_bField_new( | ||
uint64_t& handle, | ||
uint64_t& grid) | ||
-> int; | ||
|
||
/** | ||
* Delete a field object on the heap. | ||
*/ | ||
extern "C" auto bGrid_bField_delete( | ||
uint64_t& handle) | ||
-> int; | ||
|
||
extern "C" auto bGrid_bField_get_partition( | ||
uint64_t& field_handle, | ||
Neon::bGrid::Partition<int, 0>* partition_handle, | ||
Neon::Execution execution, | ||
int device, | ||
Neon::DataView data_view) | ||
-> int; | ||
|
||
extern "C" auto bGrid_get_span( | ||
uint64_t& gridHandle, | ||
Neon::bGrid::Span* spanRes, | ||
int execution, | ||
int device, | ||
int data_view) | ||
-> int; | ||
|
||
extern "C" auto bGrid_span_size( | ||
Neon::bGrid::Span* spanRes) | ||
-> int; | ||
|
||
extern "C" auto bGrid_bField_partition_size( | ||
Neon::bGrid::Partition<int, 0>* partitionPtr) | ||
-> int; | ||
|
||
extern "C" auto bGrid_get_properties( /* TODOMATT verify what the return of this method should be */ | ||
uint64_t& gridHandle, | ||
const Neon::index_3d& idx) | ||
-> int; | ||
|
||
extern "C" auto bGrid_is_inside_domain( | ||
uint64_t& gridHandle, | ||
const Neon::index_3d& idx) | ||
-> bool; | ||
|
||
extern "C" auto bGrid_bField_read( | ||
uint64_t& fieldHandle, | ||
const Neon::index_3d& idx, | ||
const int& cardinality) | ||
-> int; | ||
|
||
extern "C" auto bGrid_bField_write( | ||
uint64_t& fieldHandle, | ||
const Neon::index_3d& idx, | ||
const int& cardinality, | ||
int newValue) | ||
-> int; | ||
|
||
extern "C" auto bGrid_bField_update_host_data( | ||
uint64_t& fieldHandle, | ||
int streamSetId) | ||
-> int; | ||
|
||
extern "C" auto bGrid_bField_update_device_data( | ||
uint64_t& fieldHandle, | ||
int streamSetId) | ||
-> int; | ||
|
||
extern "C" auto dGrid_dSpan_get_member_field_offsets(std::size_t* length) | ||
-> std::size_t*; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
#include <cstdint> | ||
#include "Neon/set/Backend.h" | ||
|
||
|
||
/** | ||
* Empty constructor | ||
*/ | ||
extern "C" auto dBackend_new1( | ||
uint64_t& handle) | ||
-> int; | ||
|
||
/** | ||
* Creating a Backend object with the first nGpus devices. | ||
*/ | ||
extern "C" auto dBackend_new2( | ||
uint64_t& handle, | ||
int nGpus /*! Number of devices. The devices are selected in the order specifies by CUDA */, | ||
int runtime /*! Type of runtime to use */) | ||
-> int; | ||
|
||
/** | ||
* | ||
*/ | ||
extern "C" auto dBackend_new3( | ||
uint64_t& handle, | ||
const int* devIds /*! Vectors of device ids. There are CUDA device ids */, | ||
int runtime /*! Type of runtime to use */) | ||
-> int; | ||
|
||
|
||
|
||
|
||
|
||
/** | ||
* Delete a backend object on the heap. | ||
*/ | ||
extern "C" auto dBackend_delete( | ||
uint64_t& handle) | ||
-> int; | ||
|
||
|
||
extern "C" auto dBackend_get_string(uint64_t& handle) -> const char*; | ||
|
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
Oops, something went wrong.