Skip to content

Commit

Permalink
Rename mjMAXTHREADS -> mjMAXTHREAD (consistency).
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 599130235
Change-Id: Ia80379b8ae0574a7cd8fbc668657f806e90d6c5c
  • Loading branch information
yuvaltassa authored and copybara-github committed Jan 17, 2024
1 parent 71b0561 commit 67a00a3
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion doc/APIreference/APIglobals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ shown in the table below. Their names are in the format ``mjKEY_XXX``. They corr
- 1000
- Maximum number of textures allowed.
Defined in `mjrender.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjrender.h>`_.
* - ``mjMAXTHREADS``
* - ``mjMAXTHREAD``
- 128
- Maximum number OS threads that can be used in a thread pool.
Defined in `mjthread.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjthread.h>`_.
Expand Down
2 changes: 1 addition & 1 deletion doc/includes/references.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct mjData_ {

// memory utilization stats
size_t maxuse_stack; // maximum stack allocation in bytes
size_t maxuse_threadstack[mjMAXTHREADS]; // maximum stack allocation per thread in bytes
size_t maxuse_threadstack[mjMAXTHREAD]; // maximum stack allocation per thread in bytes
size_t maxuse_arena; // maximum arena allocation in bytes
int maxuse_con; // maximum number of contacts
int maxuse_efc; // maximum number of scalar constraints
Expand Down
2 changes: 1 addition & 1 deletion include/mujoco/mjdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct mjData_ {

// memory utilization stats
size_t maxuse_stack; // maximum stack allocation in bytes
size_t maxuse_threadstack[mjMAXTHREADS]; // maximum stack allocation per thread in bytes
size_t maxuse_threadstack[mjMAXTHREAD]; // maximum stack allocation per thread in bytes
size_t maxuse_arena; // maximum arena allocation in bytes
int maxuse_con; // maximum number of contacts
int maxuse_efc; // maximum number of scalar constraints
Expand Down
2 changes: 1 addition & 1 deletion include/mujoco/mjthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef MUJOCO_INCLUDE_MJTHREAD_H_
#define MUJOCO_INCLUDE_MJTHREAD_H_

#define mjMAXTHREADS 128 // maximum number of threads in a thread pool
#define mjMAXTHREAD 128 // maximum number of threads in a thread pool

typedef enum mjtTaskStatus_ { // status values for mjTask
mjTASK_NEW = 0, // newly created
Expand Down
2 changes: 1 addition & 1 deletion include/mujoco/mjxmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@

// vector fields of mjData
#define MJDATA_VECTOR \
X( size_t, maxuse_threadstack, mjMAXTHREADS, 1 ) \
X( size_t, maxuse_threadstack, mjMAXTHREAD, 1 ) \
X( mjWarningStat, warning, mjNWARNING, 1 ) \
X( mjTimerStat, timer, mjNTIMER, 1 ) \
X( mjSolverStat, solver, mjNILSAND, mjNSOLVER ) \
Expand Down
2 changes: 1 addition & 1 deletion src/engine/engine_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {

// clear memory utilization stats
d->maxuse_stack = 0;
mju_zeroSizeT(d->maxuse_threadstack, mjMAXTHREADS);
mju_zeroSizeT(d->maxuse_threadstack, mjMAXTHREAD);
d->maxuse_arena = 0;
d->maxuse_con = 0;
d->maxuse_efc = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/thread/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ThreadPoolImpl : public mjThreadPool {
public:
ThreadPoolImpl(int num_worker) : mjThreadPool{num_worker} {
// initialize worker threads
for (int i = 0; i < std::min(num_worker, mjMAXTHREADS); ++i) {
for (int i = 0; i < std::min(num_worker, mjMAXTHREAD); ++i) {
WorkerThread worker{
std::make_unique<std::thread>(ThreadPoolWorker, this, i)};
workers_.push_back(std::move(worker));
Expand Down
2 changes: 1 addition & 1 deletion unity/Runtime/Bindings/MjBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static class MujocoLib {
public const int mjNAUX = 10;
public const int mjMAXTEXTURE = 1000;
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTHREAD_H_ = true;
public const int mjMAXTHREADS = 128;
public const int mjMAXTHREAD = 128;
public const bool THIRD_PARTY_MUJOCO_INCLUDE_MJTNUM_H_ = true;
public const bool mjUSEDOUBLE = true;
public const double mjMINVAL = 1e-15;
Expand Down

0 comments on commit 67a00a3

Please sign in to comment.