diff mbox

[API-NEXT,v2,1/3] api: init: added thread count params

Message ID A400FC85CF2669428A5A081F01B94F531E45232D@DEMUMBX002.nsn-intra.net
State New
Headers show

Commit Message

Savolainen, Petri (Nokia - FI/Espoo) Sept. 14, 2015, 12:05 p.m. UTC
From: EXT Bill Fischofer [mailto:bill.fischofer@linaro.org]

Sent: Friday, September 11, 2015 6:45 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH v2 1/3] api: init: added thread count params



On Fri, Sep 11, 2015 at 7:55 AM, Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>> wrote:
Added max number of worker/control threads as global init
parameters. Implementation can e.g. optimize it's per worker
thread resource reservation or configuration accordingly.

Maximum values are platform specific. These values come
typically from the user as command line arguments, etc.

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>>

---
 include/odp/api/init.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)



Ordering would be relevant only for backward *binary* compatibility. Currently, we expect user to recompile between versions. The idea is that num_worker/control is likely needed to be set every time, but  log_fn and abort_fn only when user wants to change those services from their  defaults.

I was thinking 0 as default also, but it’s actually likely that user sets one of those to zero (e.g. launches only worker threads). BUT both being zero would not make sense from user POV, and we can use that as the default. I’ll add that.


-Petri


 /**
@@ -133,9 +141,10 @@ typedef struct odp_platform_init_t {
  * functions.
  *
  * @param params          Those parameters that are interpreted by the ODP API.
+ *                        Use NULL to set all parameters to their defaults.
  * @param platform_params Those parameters that are passed without
  *                        interpretation by the ODP API to the implementation.
- *
+ *                        Use NULL to set all parameters to their defaults.
  * @retval 0 on success
  * @retval <0 on failure
  *
--
2.5.1

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org<mailto:lng-odp@lists.linaro.org>
https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/init.h b/include/odp/api/init.h
index 0683d8d..d327305 100644
--- a/include/odp/api/init.h
+++ b/include/odp/api/init.h
@@ -110,8 +110,16 @@  typedef void (*odp_abort_func_t)(void) ODP_NORETURN;
  * @note It is expected that all unassigned members are zero
  */
 typedef struct odp_init_t {
-       odp_log_func_t log_fn; /**< Replacement for the default log fn */
-       odp_abort_func_t abort_fn; /**< Replacement for the default abort fn */
+       /** Maximum number of worker threads the user will run concurrently.
+           Valid range is from 0 to platform specific maximum. */
+       int num_worker;
+       /** Maximum number of control threads the user will run concurrently.
+           Valid range is from 0 to platform specific maximum. */
+       int num_control;
+       /** Replacement for the default log fn */
+       odp_log_func_t log_fn;
+       /** Replacement for the default abort fn */
+       odp_abort_func_t abort_fn;
 } odp_init_t;

Why not add the new parameters at the end of the struct?  That way we're at least making an attempt at backwards compatibility (something we need to be thinking about going forward).  I'd also have the convention that if either num_worker or num_control are 0 this means application is providing no hints and implementation defaults should apply for these values.  That way when odp_init_init() is called to initialize this struct (which also should be added) we're future-proofed.