Remove solver_nisland field from mjData.
PiperOrigin-RevId: 750527660 Change-Id: I6b34944c92483ea2abc774df75efd868255a2bac
This commit is contained in:
committed by
Copybara-Service
parent
c2ac0d724e
commit
8f768be2da
@@ -154,7 +154,6 @@ struct mjData_ {
|
|||||||
|
|
||||||
// solver statistics
|
// solver statistics
|
||||||
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
|
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
|
||||||
int solver_nisland; // number of islands processed by solver
|
|
||||||
int solver_niter[mjNISLAND]; // number of solver iterations, per island
|
int solver_niter[mjNISLAND]; // number of solver iterations, per island
|
||||||
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
|
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
|
||||||
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
|
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ struct mjData_ {
|
|||||||
|
|
||||||
// solver statistics
|
// solver statistics
|
||||||
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
|
mjSolverStat solver[mjNISLAND*mjNSOLVER]; // solver statistics per island, per iteration
|
||||||
int solver_nisland; // number of islands processed by solver
|
|
||||||
int solver_niter[mjNISLAND]; // number of solver iterations, per island
|
int solver_niter[mjNISLAND]; // number of solver iterations, per island
|
||||||
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
|
int solver_nnz[mjNISLAND]; // number of nonzeros in Hessian or efc_AR, per island
|
||||||
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
|
mjtNum solver_fwdinv[2]; // forward-inverse comparison: qfrc, efc
|
||||||
|
|||||||
@@ -777,7 +777,6 @@
|
|||||||
X( size_t, maxuse_arena ) \
|
X( size_t, maxuse_arena ) \
|
||||||
X( int, maxuse_con ) \
|
X( int, maxuse_con ) \
|
||||||
X( int, maxuse_efc ) \
|
X( int, maxuse_efc ) \
|
||||||
X( int, solver_nisland ) \
|
|
||||||
X( int, ncon ) \
|
X( int, ncon ) \
|
||||||
X( int, ne ) \
|
X( int, ne ) \
|
||||||
X( int, nf ) \
|
X( int, nf ) \
|
||||||
|
|||||||
@@ -4816,11 +4816,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
|||||||
),
|
),
|
||||||
doc='solver statistics per island, per iteration',
|
doc='solver statistics per island, per iteration',
|
||||||
),
|
),
|
||||||
StructFieldDecl(
|
|
||||||
name='solver_nisland',
|
|
||||||
type=ValueType(name='int'),
|
|
||||||
doc='number of islands processed by solver',
|
|
||||||
),
|
|
||||||
StructFieldDecl(
|
StructFieldDecl(
|
||||||
name='solver_niter',
|
name='solver_niter',
|
||||||
type=ArrayType(
|
type=ArrayType(
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ void simulate(int id, int nstep, mjtNum* ctrl) {
|
|||||||
// accumulate statistics
|
// accumulate statistics
|
||||||
contacts[id] += d[id]->ncon;
|
contacts[id] += d[id]->ncon;
|
||||||
constraints[id] += d[id]->nefc;
|
constraints[id] += d[id]->nefc;
|
||||||
int nisland = d[id]->solver_nisland;
|
int nisland = mjMAX(1, mjMIN(d[id]->nisland, mjNISLAND));
|
||||||
if (nisland == 1 || nisland == 0) {
|
if (nisland == 1 || nisland == 0) {
|
||||||
iterations[id] += d[id]->solver_niter[0];
|
iterations[id] += d[id]->solver_niter[0];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
|
|||||||
memset(sim->figcost.linepnt, 0, mjMAXLINE*sizeof(int));
|
memset(sim->figcost.linepnt, 0, mjMAXLINE*sizeof(int));
|
||||||
|
|
||||||
// number of islands that have diagnostics
|
// number of islands that have diagnostics
|
||||||
int nisland = mjMIN(d->solver_nisland, mjNISLAND);
|
int nisland = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
|
||||||
|
|
||||||
// iterate over islands
|
// iterate over islands
|
||||||
for (int k=0; k < nisland; k++) {
|
for (int k=0; k < nisland; k++) {
|
||||||
@@ -413,7 +413,7 @@ void UpdateProfiler(mj::Simulate* sim, const mjModel* m, const mjData* d) {
|
|||||||
static_cast<float>(d->nefc),
|
static_cast<float>(d->nefc),
|
||||||
static_cast<float>(sqrt_nnz),
|
static_cast<float>(sqrt_nnz),
|
||||||
static_cast<float>(d->ncon),
|
static_cast<float>(d->ncon),
|
||||||
static_cast<float>(solver_niter)
|
static_cast<float>(solver_niter) / nisland
|
||||||
};
|
};
|
||||||
|
|
||||||
// update figsize
|
// update figsize
|
||||||
@@ -582,7 +582,7 @@ void UpdateInfoText(mj::Simulate* sim, const mjModel* m, const mjData* d,
|
|||||||
char tmp[20];
|
char tmp[20];
|
||||||
|
|
||||||
// number of islands with statistics
|
// number of islands with statistics
|
||||||
int nisland = mjMIN(d->solver_nisland, mjNISLAND);
|
int nisland = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
|
||||||
|
|
||||||
// compute solver error (maximum over islands)
|
// compute solver error (maximum over islands)
|
||||||
mjtNum solerr = 0;
|
mjtNum solerr = 0;
|
||||||
|
|||||||
@@ -730,7 +730,6 @@ void mj_fwdConstraint(const mjModel* m, mjData* d) {
|
|||||||
// solve using threads
|
// solve using threads
|
||||||
mj_solCG_island_multithreaded(m, d);
|
mj_solCG_island_multithreaded(m, d);
|
||||||
}
|
}
|
||||||
d->solver_nisland = nisland;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// run solver over all constraints
|
// run solver over all constraints
|
||||||
@@ -751,9 +750,6 @@ void mj_fwdConstraint(const mjModel* m, mjData* d) {
|
|||||||
default:
|
default:
|
||||||
mjERROR("unknown solver type %d", m->opt.solver);
|
mjERROR("unknown solver type %d", m->opt.solver);
|
||||||
}
|
}
|
||||||
|
|
||||||
// one (monolithic) island
|
|
||||||
d->solver_nisland = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// save result for next step warmstart
|
// save result for next step warmstart
|
||||||
|
|||||||
@@ -1904,7 +1904,6 @@ static void _resetData(const mjModel* m, mjData* d, unsigned char debug_value) {
|
|||||||
memset(d->warning, 0, mjNWARNING*sizeof(mjWarningStat));
|
memset(d->warning, 0, mjNWARNING*sizeof(mjWarningStat));
|
||||||
memset(d->timer, 0, mjNTIMER*sizeof(mjTimerStat));
|
memset(d->timer, 0, mjNTIMER*sizeof(mjTimerStat));
|
||||||
memset(d->solver, 0, mjNSOLVER*mjNISLAND*sizeof(mjSolverStat));
|
memset(d->solver, 0, mjNSOLVER*mjNISLAND*sizeof(mjSolverStat));
|
||||||
d->solver_nisland = 0;
|
|
||||||
mju_zeroInt(d->solver_niter, mjNISLAND);
|
mju_zeroInt(d->solver_niter, mjNISLAND);
|
||||||
mju_zeroInt(d->solver_nnz, mjNISLAND);
|
mju_zeroInt(d->solver_nnz, mjNISLAND);
|
||||||
mju_zero(d->solver_fwdinv, 2);
|
mju_zero(d->solver_fwdinv, 2);
|
||||||
|
|||||||
@@ -1008,9 +1008,8 @@ void mj_printFormattedData(const mjModel* m, const mjData* d, const char* filena
|
|||||||
// SOLVER STAT
|
// SOLVER STAT
|
||||||
if (d->nefc) {
|
if (d->nefc) {
|
||||||
fprintf(fp, "SOLVER STAT\n");
|
fprintf(fp, "SOLVER STAT\n");
|
||||||
fprintf(fp, " solver_nisland = %d\n", d->solver_nisland);
|
|
||||||
printVector(" solver_fwdinv = ", d->solver_fwdinv, 2, fp, float_format);
|
printVector(" solver_fwdinv = ", d->solver_fwdinv, 2, fp, float_format);
|
||||||
int nisland_stat = mjMIN(d->solver_nisland, mjNISLAND);
|
int nisland_stat = mjMAX(1, mjMIN(d->nisland, mjNISLAND));
|
||||||
for (int island=0; island < nisland_stat; island++) {
|
for (int island=0; island < nisland_stat; island++) {
|
||||||
int niter_stat = mjMIN(mjNSOLVER, d->solver_niter[island]);
|
int niter_stat = mjMIN(mjNSOLVER, d->solver_niter[island]);
|
||||||
if (niter_stat) {
|
if (niter_stat) {
|
||||||
|
|||||||
@@ -4826,7 +4826,6 @@ public unsafe struct mjData_ {
|
|||||||
public mjSolverStat_ solver3997;
|
public mjSolverStat_ solver3997;
|
||||||
public mjSolverStat_ solver3998;
|
public mjSolverStat_ solver3998;
|
||||||
public mjSolverStat_ solver3999;
|
public mjSolverStat_ solver3999;
|
||||||
public int solver_nisland;
|
|
||||||
public fixed int solver_niter[20];
|
public fixed int solver_niter[20];
|
||||||
public fixed int solver_nnz[20];
|
public fixed int solver_nnz[20];
|
||||||
public fixed double solver_fwdinv[2];
|
public fixed double solver_fwdinv[2];
|
||||||
|
|||||||
Reference in New Issue
Block a user