myo.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. /*
  2. * Copyright 2010-2013 Intel Corporation.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, version 2.1.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Lesser General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Lesser General Public
  14. * License along with this library; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. * 02110-1301 USA.
  17. *
  18. * Disclaimer: The codes contained in these modules may be specific
  19. * to the Intel Software Development Platform codenamed Knights Ferry,
  20. * and the Intel product codenamed Knights Corner, and are not backward
  21. * compatible with other Intel products. Additionally, Intel will NOT
  22. * support the codes or instruction set in future products.
  23. *
  24. * Intel offers no warranty of any kind regarding the code. This code is
  25. * licensed on an "AS IS" basis and Intel is not obligated to provide
  26. * any support, assistance, installation, training, or other services
  27. * of any kind. Intel is also not obligated to provide any updates,
  28. * enhancements or extensions. Intel specifically disclaims any warranty
  29. * of merchantability, non-infringement, fitness for any particular
  30. * purpose, and any other warranty.
  31. *
  32. * Further, Intel disclaims all liability of any kind, including but
  33. * not limited to liability for infringement of any proprietary rights,
  34. * relating to the use of the code, even if Intel is notified of the
  35. * possibility of such liability. Except as expressly stated in an Intel
  36. * license agreement provided with this code and agreed upon with Intel,
  37. * no license, express or implied, by estoppel or otherwise, to any
  38. * intellectual property rights is granted herein.
  39. */
  40. /**
  41. * Description:
  42. * External APIs of MYO runtime (MYO stands for Mine, Yours and Ours).
  43. **/
  44. #ifndef _MYO_H_
  45. #define _MYO_H_
  46. #include "myotypes.h"
  47. #include "myoimpl.h"
  48. /** @ingroup MYO
  49. * @addtogroup MYO_API
  50. @{
  51. * @file myo.h
  52. */
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56. /****************************************************************************
  57. Arena-based APIs
  58. ***************************************************************************/
  59. /*
  60. * Arena is a set of memory pages with the same ownership type. The ownership
  61. * type of all the memory pages inside the same arena can only be changed as
  62. * a whole. For "OURS", it is also the minimal unit of sync operations to
  63. * implement "release consistency".
  64. */
  65. /** @fn extern MyoError myoArenaCreate(MyoOwnershipType in_Type,
  66. * int in_Property, MyoArena *out_pArena)
  67. * @brief Create an arena with specified ownership type and property.
  68. *
  69. * @param in_Type Specified ownership type (MYO_ARENA_OURS or
  70. * MYO_ARENA_MINE).
  71. * @param in_Property Specified properties of the arena. Set it
  72. * to 0 to use default properties.
  73. *
  74. * MYO_RELEASE_CONSISTENCY or MYO_STRONG_RELEASE_CONSISTENCY
  75. * or MYO_STRONG_CONSISTENCY:
  76. *
  77. * Consistency modes for "OURS" arenas. For MYO_RELEASE_CONSISTENCY,
  78. * there are 2 functions, "Acquire" and "Release", which are
  79. * used for memory ordering. "Release" makes all local stores
  80. * prior to the release globally visible; "Acquire" syncs up the
  81. * local memory with all stores that have been made globally
  82. * visible. However, there is no definite answer as to whether
  83. * local stores can be globally visible before reaching a release
  84. * point, nor whether the newest globally visible stores can be
  85. * updated to local before reaching an acquire point. By using
  86. * MYO_STRONG_RELEASE_CONSISTENCY, the answer to these questions
  87. * is "no". A sequential consistency model is maintained to the
  88. * arena when using MYO_STRONG_CONSISTENCY.
  89. * MYO_RELEASE_CONSISTENCY is the default property.
  90. *
  91. * MYO_UPDATE_ON_DEMAND or MYO_UPDATE_ON_ACQUIRE:
  92. *
  93. * Only apply to "OURS" arenas with "Release Consistency".
  94. * MYO_UPDATE_ON_ACQUIRE means that the shared pages of this
  95. * arena will be updated on acquire point; MYO_UPDATE_ON_DEMAND
  96. * means that the shared pages will not be updated until they
  97. * are accessed. MYO_UPDATE_ON_DEMAND is the default property.
  98. *
  99. * MYO_RECORD_DIRTY or MYO_NOT_RECORD_DIRTY:
  100. *
  101. * This property controls whether to record dirty pages.
  102. * There will be runtime overhead when recording dirty pages,
  103. * as it can reduce the communication data. It is a trade-off
  104. * for performance. Also when MYO_NOT_RECORD_DIRTY is set for
  105. * "OURS" arena, the runtime cannot guarantee the correctness
  106. * when the host and card modify the same shared page between
  107. * the same sync segment. MYO_RECORD_DIRTY is the default
  108. * property.
  109. *
  110. * MYO_ONE_VERSION or MYO_MULTI_VERSION:
  111. *
  112. * Only apply to "OURS" arenas with "Release Consistency". When
  113. * MYO_MULTI_VERSION is set, this arena can only be "release" on
  114. * HOST side and "acquire" on CARD side. Releasing the arena on
  115. * HOST will create a new versioned data and put it into a FIFO;
  116. * acquiring the arena on CARD will get the versioned data
  117. * from the FIFO one by one. MYO_ONE_VERSION is the default
  118. * property.
  119. *
  120. * MYO_CONSISTENCY or MYO_NO_CONSISTENCY:
  121. *
  122. * Only apply to "OURS" arenas with "Release Consistency". When
  123. * MYO_NO_CONSISTENCY is set, the consistency of the arena will
  124. * not be maintained. That is, it is a no-op operation when
  125. * calling acquire/release for such arenas. MYO_CONSISTENCY is
  126. * the default property.
  127. *
  128. * MYO_HOST_TO_DEVICE and MYO_DEVICE_TO_HOST:
  129. *
  130. * When it is certain that there is only one communication
  131. * direction for this arena, it can be created with only
  132. * MYO_HOST_TO_DEVICE or MYO_DEVICE_TO_HOST so the runtime
  133. * can perform optimizations. The default property is
  134. * MYO_HOST_TO_DEVICE | MYO_DEVICE_TO_HOST.
  135. *
  136. * @param out_pArena Used to store the handle of the created arena.
  137. * @return
  138. * MYO_SUCCESS; or
  139. * an error number to indicate the error.
  140. **/
  141. MYOACCESSAPI
  142. CILK_SHARED MyoError myoArenaCreate(MyoOwnershipType in_Type, int in_Property, MyoArena *out_pArena);
  143. /** @fn extern MyoError myoArenaDestroy(MyoArena in_Arena)
  144. * @brief Destroy an arena. As a result, the arena can not be
  145. * referred any more.
  146. *
  147. * @param in_Arena Arena handle returned by previous call to
  148. * myoArenaCreate.
  149. * @return
  150. * MYO_SUCCESS; or
  151. * an error number to indicate the error.
  152. **/
  153. MYOACCESSAPI
  154. CILK_SHARED MyoError myoArenaDestroy(MyoArena in_Arena);
  155. /** @fn extern void *myoArenaMalloc(MyoArena in_Arena, size_t in_Size)
  156. * @brief Allocates size bytes from the specified arena, and returns
  157. * the start address of the allocated memory. The memory is not
  158. * cleared.
  159. *
  160. * @param in_Arena Arena handle returned by previous call to
  161. * myoArenaCreate.
  162. * @param in_Size Size (bytes) of the required memory space.
  163. * @return
  164. * The start address of the allocated memory space.
  165. * NULL: Failed.
  166. **/
  167. MYOACCESSAPI
  168. void *myoArenaMalloc(MyoArena in_Arena, size_t in_Size);
  169. /** @fn extern void myoArenaFree(MyoArena in_Arena, void *in_pPtr)
  170. * @brief Frees the memory space allocated by myoArenaMalloc to the
  171. * specified arena.
  172. *
  173. * @param in_Arena Arena handle returned by previous call to
  174. * myoArenaCreate.
  175. * @param in_pPtr The start address of the specified memory
  176. * space, which must be retured by myoArenaMalloc.
  177. * @return
  178. **/
  179. MYOACCESSAPI
  180. void myoArenaFree(MyoArena in_Arena, void *in_pPtr);
  181. /** @fn extern void *myoArenaAlignedMalloc(MyoArena in_Arena,
  182. * size_t in_Size, size_t in_Alignment)
  183. * @brief Allocates size bytes from the specified arena. The
  184. * start address of the allocated memory will be a multiple of the
  185. * alignment, which must be a power of two.
  186. *
  187. * @param in_Arena Arena handle returned by previous call to
  188. * myoArenaCreate.
  189. * @param in_Size Size (bytes) of the required memory space.
  190. * @param in_Alignment The alignment value (must be a power
  191. * of two).
  192. * @return
  193. * The start address of the allocated memory space.
  194. * NULL: Failed.
  195. **/
  196. MYOACCESSAPI
  197. void *myoArenaAlignedMalloc(MyoArena in_Arena, size_t in_Size, size_t in_Alignment);
  198. /** @fn extern void myoArenaAlignedFree(MyoArena in_Arena, void *in_pPtr)
  199. * @brief Frees the memory space allocated by myoArenaAlignedMalloc
  200. * to the specified arena.
  201. *
  202. * @param in_Arena Arena handle returned by previous call to
  203. * myoArenaCreate.
  204. * @param in_pPtr The start address of the specified memory space,
  205. * which must be returned by myoArenaAlignedMalloc.
  206. * @return
  207. **/
  208. MYOACCESSAPI
  209. void myoArenaAlignedFree(MyoArena in_Arena, void *in_pPtr);
  210. /** @fn extern MyoError myoArenaAcquire(MyoArena in_Arena)
  211. * @brief myoArenaAcquire is the sync point for "OURS" arena with
  212. * "Release Consistency". myoArenaAcquire is used to obtain all
  213. * stores of "OURS" arena that have been made globally visible prior
  214. * to this point.
  215. *
  216. * @param in_Arena Arena handle returned by previous call to
  217. * myoArenaCreate.
  218. * @return
  219. * MYO_SUCCESS; or
  220. * an error number to indicate the error.
  221. **/
  222. MYOACCESSAPI
  223. CILK_SHARED MyoError myoArenaAcquire(MyoArena in_Arena);
  224. /** @fn extern MyoError myoArenaRelease(MyoArena in_Arena)
  225. * @brief myoArenaRelease is the sync point for "OURS" arena with
  226. * "Release Consistency". myoArenaRelease is used to flush all prior
  227. * stores of "OURS" arena to be globally visible.
  228. *
  229. * @param in_Arena Arena handle returned by previous call to
  230. * myoArenaCreate.
  231. * @return
  232. * MYO_SUCCESS; or
  233. * an error number to indicate the error.
  234. **/
  235. MYOACCESSAPI
  236. CILK_SHARED MyoError myoArenaRelease(MyoArena in_Arena);
  237. /** @fn extern MyoError myoArenaAcquireOwnership(MyoArena in_Arena)
  238. * @brief Changes the ownership type of the arena to MYO_ARENA_MINE.
  239. *
  240. * @param in_Arena Arena handle returned by previous call to
  241. * myoArenaCreate.
  242. * @return
  243. * MYO_SUCCESS; or
  244. * an error number to indicate the error.
  245. **/
  246. MYOACCESSAPI
  247. MyoError myoArenaAcquireOwnership(MyoArena in_Arena);
  248. /** @fn extern MyoError myoArenaReleaseOwnership(MyoArena in_Arena)
  249. * @brief Change the ownership type of the arena to MYO_ARENA_OURS.
  250. *
  251. * @param in_Arena Arena handle returned by previous call to
  252. * myoArenaCreate.
  253. * @return
  254. * MYO_SUCCESS; or
  255. * an error number to indicate the error.
  256. **/
  257. MYOACCESSAPI
  258. MyoError myoArenaReleaseOwnership(MyoArena in_Arena);
  259. /** @fn extern MyoError myoArenaGetHandle(void *in_pPtr,
  260. * MyoArena *out_pArena)
  261. * @brief Gets the arena handle of the arena that contains the memory
  262. * space pointed to by "in_pPtr". This API can be used when it is
  263. * not clear which arena handle should be used for other arena
  264. * related APIs.
  265. *
  266. * @param in_pPtr The start address of a chunk of memory space.
  267. * @param out_pArena Handle of the arena.
  268. * @return
  269. * MYO_SUCCESS; or
  270. * an error number to indicate the error.
  271. **/
  272. MYOACCESSAPI
  273. CILK_SHARED MyoError myoArenaGetHandle(void *in_pPtr, MyoArena *out_pArena);
  274. /********************************************************************************
  275. APIs for the default arena
  276. *******************************************************************************/
  277. /**
  278. * There will be a default arena inside MYO runtime, which will be used when
  279. * there is no specified arena.
  280. **/
  281. /** @fn extern void* myoSharedMalloc(size_t in_Size)
  282. * @brief Allocates size bytes from the default arena, and returns the
  283. * start address of the allocated memory. The memory is not cleared.
  284. *
  285. @param in_Size Size (bytes) of the required memory space.
  286. * @return
  287. * The start address of the allocated memory space.
  288. * NULL: Failed.
  289. **/
  290. MYOACCESSAPI
  291. void* myoSharedMalloc(size_t in_Size);
  292. /** @fn extern void myoSharedFree(void *in_pPtr)
  293. * @brief Frees the memory space allocated by myoArenaMalloc to the
  294. * default arena.
  295. *
  296. * @param in_pPtr The start address of the specified memory space,
  297. * which must be retured by myoSharedMalloc.
  298. * @return
  299. **/
  300. MYOACCESSAPI
  301. void myoSharedFree(void *in_pPtr);
  302. /** @fn extern void* myoSharedAlignedMalloc(size_t in_Size,
  303. * size_t in_Alignment)
  304. * @brief Allocates size bytes from the default arena. The start
  305. * address of the allocated memory will be a multiple of alignment,
  306. * which must be a power of two.
  307. *
  308. * @param in_Size Size (bytes) of the required memory space.
  309. * @param in_Alignment The alignment value, which must be an power of two.
  310. * @return
  311. * The start address of the allocated memory space.
  312. * NULL: Failed.
  313. **/
  314. MYOACCESSAPI
  315. void* myoSharedAlignedMalloc(size_t in_Size, size_t in_Alignment);
  316. /** @fn extern void myoSharedAlignedFree(void *in_pPtr)
  317. * @brief Frees the memory space allocated by myoArenaAlignedMalloc
  318. * to the default arena.
  319. *
  320. * @param in_pPtr The start address of the specified memory space,
  321. * which must be returned by myoArenaAlignedMalloc.
  322. * @return
  323. **/
  324. MYOACCESSAPI
  325. void myoSharedAlignedFree(void *in_pPtr);
  326. /** @fn extern MyoError myoAcquire()
  327. * @brief myoAcquire is the sync point for the default arena with
  328. * "Release Consistency". myoAcquire is used to obtain all stores of
  329. * the default arena that have been made globally visible prior to
  330. * this point.
  331. *
  332. * @return
  333. * MYO_SUCCESS; or
  334. * an error number to indicate the error.
  335. **/
  336. MYOACCESSAPI
  337. MyoError myoAcquire();
  338. /** @fn extern MyoError myoRelease()
  339. * @brief myoRelease is the sync point for the default arena with
  340. * "Release Consistency". myoRelease is used to flush all prior stores
  341. * of the default arena to be globally visible.
  342. *
  343. * @return
  344. * MYO_SUCCESS; or
  345. * an error number to indicate the error.
  346. **/
  347. MYOACCESSAPI
  348. MyoError myoRelease();
  349. /** @fn extern MyoError myoAcquireOwnership()
  350. * @brief Changes the ownership type of the default arena to
  351. * MYO_ARENA_MINE.
  352. *
  353. * @return
  354. * MYO_SUCCESS; or
  355. * an error number to indicate the error.
  356. **/
  357. MYOACCESSAPI
  358. MyoError myoAcquireOwnership();
  359. /** @fn extern MyoError myoReleaseOwnership()
  360. * @brief Change the ownership type of the default arena to
  361. * MYO_ARENA_OURS.
  362. *
  363. * @return
  364. * MYO_SUCCESS; or
  365. * an error number to indicate the error.
  366. **/
  367. MYOACCESSAPI
  368. MyoError myoReleaseOwnership();
  369. /*****************************************************************************
  370. APIs for global sync operations.
  371. *****************************************************************************/
  372. /** @fn extern MyoError myoMutexCreate(MyoMutex *out_pMutex)
  373. * @brief Create a mutex and return the mutex handle.
  374. *
  375. * @param out_pMutex Used to store the handle of the created mutex.
  376. * @return
  377. * MYO_SUCCESS; or
  378. * an error number to indicate the error.
  379. **/
  380. MYOACCESSAPI
  381. MyoError myoMutexCreate(MyoMutex *out_pMutex);
  382. /** @fn extern MyoError myoMutexLock(MyoMutex in_Mutex)
  383. * @brief Lock the mutex. If the mutex is already locked by other peers,
  384. * the call blocks until the mutex becomes available. Currently,
  385. * attempting to re-acquire the mutex will cause a deadlock.
  386. *
  387. * @param in_Mutex the mutex handle returned by myoMutexCreate.
  388. * @return
  389. * MYO_SUCCESS; or
  390. * an error number to indicate the error.
  391. **/
  392. MYOACCESSAPI
  393. MyoError myoMutexLock(MyoMutex in_Mutex);
  394. /** @fn extern MyoError myoMutexUnlock(MyoMutex in_Mutex)
  395. * @brief Release the locked mutex.
  396. * Currently, attempting to release an unlocked mutex will cause
  397. * undefined results.
  398. *
  399. * @param in_Mutex the mutex handle returned by myoMutexCreate.
  400. * @return
  401. * MYO_SUCCESS; or
  402. * an error number to indicate the error.
  403. **/
  404. MYOACCESSAPI
  405. MyoError myoMutexUnlock(MyoMutex in_Mutex);
  406. /** @fn extern MyoError myoMutexTryLock(MyoMutex in_Mutex)
  407. * @brief Try to lock the mutex. myoMutexTryLock is equivalent to
  408. * myoMutexLock, except that myoMutexLock will return immediately if
  409. * the mutex is already locked.
  410. *
  411. * @param in_Mutex the mutex handle returned by myoMutexCreate.
  412. * @return
  413. * MYO_SUCCESS; or
  414. * an error number to indicate the error.
  415. **/
  416. MYOACCESSAPI
  417. MyoError myoMutexTryLock(MyoMutex in_Mutex);
  418. /** @fn extern MyoError myoMutexDestroy(MyoMutex in_Mutex)
  419. * @brief Destroy the mutex.
  420. *
  421. * @param in_Mutex the mutex handle returned by myoMutexCreate.
  422. * @return
  423. * MYO_SUCCESS; or
  424. * an error number to indicate the error.
  425. **/
  426. MYOACCESSAPI
  427. MyoError myoMutexDestroy(MyoMutex in_Mutex);
  428. /** @fn extern MyoError myoSemCreate(int in_Value, MyoSem *out_pSem)
  429. * @brief Create a semaphore and return the semaphore handle.
  430. *
  431. * @param in_Value the initial value for the semaphore.
  432. * @param out_pSem Used to store the handle of the created semaphore.
  433. * @return
  434. * MYO_SUCCESS; or
  435. * an error number to indicate the error.
  436. **/
  437. MYOACCESSAPI
  438. MyoError myoSemCreate(int in_Value, MyoSem *out_pSem);
  439. /** @fn extern MyoError myoSemWait(MyoSem in_Sem)
  440. * @brief Decrements (locks) the semaphore. If the semaphore value is
  441. * greater than zero, then the decrement proceeds and the function
  442. * returns immediately, or else the call blocks until the semaphore
  443. * value rises above zero.
  444. *
  445. * @param in_Sem the semaphore handle returned by myoSemCreate.
  446. * @return
  447. * MYO_SUCCESS; or
  448. * an error number to indicate the error.
  449. **/
  450. MYOACCESSAPI
  451. MyoError myoSemWait(MyoSem in_Sem);
  452. /** @fn extern MyoError myoSemPost(MyoSem in_Sem)
  453. * @brief Increments (unlocks) the semaphore. If the semaphore value
  454. * becomes greater than zero, one blocked myoSemWait call will be
  455. * notified to return.
  456. *
  457. * @param in_Sem the semaphore handle returned by myoSemCreate.
  458. * @return
  459. * MYO_SUCCESS; or
  460. * an error number to indicate the error.
  461. **/
  462. MYOACCESSAPI
  463. MyoError myoSemPost(MyoSem in_Sem);
  464. /** @fn extern MyoError myoSemTryWait(MyoSem in_Sem)
  465. * @brief Try to lock semaphore. myoSemTryWait is the same as
  466. * myoSemAcquire, except that if the decrement cannot be immediately
  467. * performed, then the call returns instead of blocking.
  468. *
  469. * @param in_Sem the semaphore handle returned by myoSemCreate.
  470. * @return
  471. * MYO_SUCCESS; or
  472. * an error number to indicate the error.
  473. **/
  474. MYOACCESSAPI
  475. MyoError myoSemTryWait(MyoSem in_Sem);
  476. /** @fn extern MyoError myoSemDestroy(MyoSem in_Sem)
  477. * @brief Destroy the semaphore.
  478. *
  479. * @param in_Sem the semaphore handle returned by myoSemCreate.
  480. * @return
  481. * MYO_SUCCESS; or
  482. * an error number to indicate the error.
  483. **/
  484. MYOACCESSAPI
  485. MyoError myoSemDestroy(MyoSem in_Sem);
  486. /** @fn extern MyoError myoBarrierCreate(int in_Count, MyoBarrier *out_pBarrier)
  487. * @brief Create a barrier and return the barrier handle.
  488. *
  489. * @param in_Count the number of threads that must call
  490. * myoBarrierWait before any of them successfully return.
  491. * @param out_pBarrier Used to store the handle of the created
  492. * barrier.
  493. * @return
  494. * MYO_SUCCESS; or
  495. * an error number to indicate the error.
  496. **/
  497. MYOACCESSAPI
  498. MyoError myoBarrierCreate(int in_Count, MyoBarrier *out_pBarrier);
  499. /** @fn extern MyoError myoBarrierWait(MyoBarrier in_Barrier)
  500. * @brief The caller will block until the required number of threads
  501. * have called myoBarrierWait with the same barrier handle.
  502. *
  503. * @param in_Barrier the barrier handle returned by myoBarrierCreate.
  504. * @return
  505. * MYO_SUCCESS; or
  506. * an error number to indicate the error.
  507. **/
  508. MYOACCESSAPI
  509. MyoError myoBarrierWait(MyoBarrier in_Barrier);
  510. /** @fn extern MyoError myoBarrierDestroy(MyoBarrier in_Barrier)
  511. * @brief Destroy the barrier.
  512. *
  513. * @param in_Barrier the barrier handle returned by myoBarrierCreate.
  514. * @return
  515. * MYO_SUCCESS; or
  516. * an error number to indicate the error.
  517. **/
  518. MYOACCESSAPI
  519. MyoError myoBarrierDestroy(MyoBarrier in_Barrier);
  520. /*****************************************************************************
  521. MISC APIs.
  522. *****************************************************************************/
  523. /**
  524. * @cond INCLUDE_MYO_INTERNAL_DOCUMENTATION
  525. **/
  526. MYOACCESSAPI
  527. int myoMyId();
  528. /* int myoNumNodes() returns the number of peers, minus one, to
  529. equal the number of cards in the system. */
  530. MYOACCESSAPI
  531. int myoNumNodes();
  532. MYOACCESSAPI
  533. unsigned long long myoTicks();
  534. MYOACCESSAPI
  535. unsigned long long myoWallTime();
  536. MYOACCESSAPI
  537. void myoStatOn();
  538. MYOACCESSAPI
  539. void myoStatOff();
  540. /** @fn extern MyoError myoGetMemUsage(uint64 *out_memUsedMB)
  541. * @brief Retrieves the amount of shared memory currently used.
  542. * myoGetMemUsage() fills in out_memUsedMB when the pointer is not NULL.
  543. *
  544. * @param out_memUsedBytes, pointer to the current size shared memory used.
  545. * @return
  546. * MYO_SUCCESS; or
  547. * an error number to indicate the error.
  548. **/
  549. MYOACCESSAPI
  550. MyoError myoGetMemUsage(unsigned int *out_memUsedMB);
  551. /** @fn extern MyoError myoHTimeOn(int in_On)
  552. * @brief Toggle MYO HTime report feature on/off.
  553. *
  554. * @param in_On: 1 turn on MYO HTime report
  555. * 0 turn off MYO HTime report
  556. * @return
  557. * MYO_SUCCESS; or
  558. * an error number to indicate the error.
  559. **/
  560. extern MyoError myoHTimeOn(int in_On);
  561. #ifdef __cplusplus
  562. }
  563. #endif
  564. #endif
  565. /**
  566. * @endcond
  567. **/
  568. /*! @} */