Skip to content

Commit

Permalink
Merge branch 'qss-solver-dev' into release-4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinffernandez committed Aug 28, 2024
2 parents 1a157fb + da5616c commit 1de237c
Show file tree
Hide file tree
Showing 123 changed files with 14,566 additions and 1,671 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ jobs:
sudo apt-get install pkgconf
sudo apt-get install python
sudo apt-get install qt5-default
sudo apt-get install rapidjson-dev
- name: Build
working-directory: ./src
run: make
run: make repo_checkout=https

- name: Install
working-directory: ./src
Expand Down
10 changes: 5 additions & 5 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ def get_files():
'--name-only', 'HEAD']).split()

def apply_code_style():
files = filter(lambda x: x.find('tests/system/gt_data') == -1, get_files())
files = filter(lambda x: x.find(b'tests/system/gt_data') == -1, get_files())

files = filter(lambda x: x.endswith('.c') or
x.endswith('.h') or
x.endswith('.cpp'), files)
files = filter(lambda x: x.endswith(b'.c') or
x.endswith(b'.h') or
x.endswith(b'.cpp'), files)
for f in files:
print("Apply code style to: " + f)
print("Apply code style to: " + str(f))
subprocess.check_output(['clang-format-7', '-i', f])
subprocess.check_output(['git', 'add', f])

Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"sonarlint.pathToCompileCommands": "${workspaceFolder}/src/engine/compile_commands.json",
"files.associations": {
"patoh.h": "c",
"scotch.h": "c",
"utils.h": "c"
}
}
14 changes: 14 additions & 0 deletions deploy/linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**Release procedure**

- Checkout `qss-solver-release` branch.
- Create branch `release-X.X.X`.
- Merge `qss-solver-dev` -> `qss-solver-release`.
- Update `version` file to `X.X.X`.
- Run `update.sh`.
- Commit update changes with `-n`.
- Update `CHANGELOG` and `README.md` files.
- Commit changes with `-n`.
- Push branch.
- Merge pushed branch in `qss-solver-release` with `--squash`.
- Push `qss-solver-release` branch.
- Merge `qss-solver-release` in `qss-solver-dev`.
12 changes: 10 additions & 2 deletions deploy/linux/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,24 @@ echo $INI_VER >> ./deploy/linux/qss-solver.ini
# Set OS config files.
CONTROL_FILE="control.amd64"
SBML_LIB="libsbml.so.5.18.0"
PACKAGE_NAME=qss-solver-$VER.deb
PACKAGE_NAME=qss-solver-$VER
SYSTEM_VERSION=`lsb_release -d`
if [[ "$SYSTEM_VERSION" == *"22.04"* ]]; then
CONTROL_FILE="control.amd64.u22"
SBML_LIB="libsbml.so.5.19.0"
PACKAGE_NAME=qss-solver-$VER-u22.deb
PACKAGE_NAME=$PACKAGE_NAME-u22
fi

# Set solver branch
BRANCH=`git rev-parse --abbrev-ref HEAD`

# If build from development branch, update package name to unstable.
if [ "$BRANCH" == "qss-solver-dev" ]; then
PACKAGE_NAME=$PACKAGE_NAME-unstable
fi

PACKAGE_NAME=$PACKAGE_NAME.deb

BRANCH="branch="$BRANCH
echo $BRANCH >> ./deploy/linux/qss-solver.ini

Expand Down
15 changes: 12 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Target variables
MODE ?= Debug
DISTRO := $(shell lsb_release -r 2>/dev/null | grep Release | awk '{ print $$2 }')
sbg_branch ?= sb-graph-dev
build_sbg ?= True
repo_checkout ?= ssh

# Build cores.
CORES = $(shell nproc)
Expand All @@ -18,7 +21,7 @@ mmo-interfaces: create-folders
@cd interfaces/sbml && $(MAKE) MODE=$(MODE) -j $(CORES)
@echo Done

qss-engine: create-folders
qss-engine: create-folders lib-gtest
@echo BUILDING QSS LIBRARIES DEPS
@cd engine && $(MAKE) cvode
@cd engine && $(MAKE) ida
Expand All @@ -36,11 +39,14 @@ qss-user-libs: create-folders qss-engine
@echo Done

mmo-compiler: create-folders lib-gtest
@echo BUILDING MICROMODELICA C COMPILER DEPS
@cd mmoc && $(MAKE) MODE=$(MODE) lib_sbg sbg_branch=$(sbg_branch) build_sbg=$(build_sbg) repo_checkout=$(repo_checkout)
@echo Done
@echo BUILDING MICROMODELICA C COMPILER
@cd mmoc && $(MAKE) MODE=$(MODE) -j $(CORES)
@echo Done

qss-solver-gui: create-folders
qss-solver-gui: create-folders lib-gtest
@echo BUILDING MMO EDITOR
@cd gui && $(MAKE) -f gui.makefile MODE=$(MODE) -j $(CORES)
@echo Done
Expand Down Expand Up @@ -99,7 +105,10 @@ clean:
@cd interfaces/sbml && $(MAKE) clean

help:
@echo "make MODE=<Debug|Release> "
@echo "make MODE=<Debug|Release> sbg_branch=<BRANCH_NAME> build_sbg=<True|False> repo_checkout=<ssh|https>"
@echo "Default values:"
@echo ""
@echo "MODE=Debug"
@echo "sbg_branch=sb-graph-dev"
@echo "build_sbg=True"
@echo "repo_checkout=ssh"
19 changes: 19 additions & 0 deletions src/engine/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@
"ignoreFailures": true
}
]
},

// Advection model
{
"name": "Advection.",
"type": "cppdbg",
"request": "launch",
"program": "/home/joaquin/work/qss-solver/build/advection/advection",
"cwd": "/home/joaquin/work/qss-solver/build/advection/",
"environment": [],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}

]
}
18 changes: 16 additions & 2 deletions src/engine/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{
"files.associations": {
"random": "cpp"
"random": "cpp",
"qss_bdf.h": "c",
"array": "c",
"compare": "c",
"functional": "c",
"istream": "c",
"ostream": "c",
"ranges": "c",
"tuple": "c",
"type_traits": "c",
"utility": "c",
"typeindex": "c",
"typeinfo": "c",
"qss_data.h": "c"
},
"C_Cpp.dimInactiveRegions": true
"C_Cpp.dimInactiveRegions": true,
"sonarlint.pathToCompileCommands": "${workspaceFolder}/compile_commands.json"
}
7 changes: 7 additions & 0 deletions src/engine/classic/classic_cvode_integrator.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ void CVODE_integrate(SIM_simulator simulate)
if (check_flag(&flag, "CVDense", 1, simulator)) return;
}

if (simulator->data->params->CVODE_max_order != 0) {
flag = CVodeSetMaxOrd(cvode_mem, simulator->data->params->CVODE_max_order);
if (check_flag(&flag, "CVodeSetMaxOrd", 1, simulator)) {
return;
}
}

getTime(simulator->stats->sTime);
if (is_sampled) {
CLC_save_step(simOutput, solution, solution_time, t, totalOutputSteps, NV_DATA_S(y), clcData->d, clcData->alg);
Expand Down
6 changes: 3 additions & 3 deletions src/engine/classic/classic_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ CLC_data CLC_Data(int states, int discretes, int events, int inputs, int algebra
strcat(fileName, ".ini");
SET_settings settings = SET_Settings(fileName);
CLC_data p = checkedMalloc(sizeof(*p));
int i;
p->states = states;
p->discretes = discretes;
p->events = events;
Expand Down Expand Up @@ -78,14 +77,15 @@ CLC_data CLC_Data(int states, int discretes, int events, int inputs, int algebra
cleanVector(p->nDS, 0, states);
double sameDQMin = (settings->nDQMin == 1) ? settings->dqmin[0] : 0;
double sameDQRel = (settings->nDQRel == 1) ? settings->dqrel[0] : 0;
for (i = 0; i < states; i++) {
for (int i = 0; i < states; i++) {
p->nSD[i] = 0;
p->dQMin[i] = (sameDQMin > 0) ? sameDQMin : settings->dqmin[i];
p->dQRel[i] = (sameDQRel > 0) ? sameDQRel : settings->dqrel[i];
}
p->event = SD_EventData(events);
p->params = SD_Parameters(settings->derdelta, settings->zchyst, settings->minstep, settings->symdiff, settings->lps, settings->nodesize,
settings->pm, settings->dt, settings->dtSynch, settings->partitionerOptions, settings->jacobian);
settings->pm, settings->dt, settings->dtSynch, settings->partitionerOptions, settings->jacobian,
settings->CVODE_max_order, settings->x_output);
p->scalarEvaluations = 0;
p->zeroCrossings = 0;
p->funEvaluations = 0;
Expand Down
22 changes: 13 additions & 9 deletions src/engine/common/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ void SD_cleanEventData(SD_eventData events, int size)
}

SD_parameters SD_Parameters(double derDelta, double zcHyst, double minStep, int symDiff, int lps, int nodeSize, SD_PartitionMethod pm,
double dt, SD_DtSynch synch, SD_partitionerOptions partitionerOptions, int jacobian)
double dt, SD_DtSynch synch, SD_partitionerOptions partitionerOptions, int jacobian, int CVODE_max_order,
int x_output)
{
SD_parameters p = checkedMalloc(sizeof(*p));
p->derDelta = derDelta;
Expand All @@ -185,10 +186,12 @@ SD_parameters SD_Parameters(double derDelta, double zcHyst, double minStep, int
p->dtSynch = synch;
p->partitionerOptions = partitionerOptions;
p->jacobian = jacobian;
p->CVODE_max_order = CVODE_max_order;
p->x_output = x_output;
return p;
}

SD_parameters SD_copyParameters(SD_parameters parameters)
SD_parameters SD_copyParameters(const_SD_parameters parameters)
{
SD_parameters p = checkedMalloc(sizeof(*p));
p->derDelta = parameters->derDelta;
Expand All @@ -199,6 +202,7 @@ SD_parameters SD_copyParameters(SD_parameters parameters)
p->nodeSize = parameters->nodeSize;
p->pm = parameters->pm;
p->dt = parameters->dt;
p->x_output = parameters->x_output;
return p;
}

Expand Down Expand Up @@ -436,8 +440,8 @@ SD_jacMatrix SD_JacMatrix(int variables)

void SD_allocJacMatrix(SD_jacMatrix jac_matrix)
{
int i, variables = jac_matrix->variables;
for (i = 0; i < variables; i++) {
int variables = jac_matrix->variables;
for (int i = 0; i < variables; i++) {
int size = jac_matrix->size[i];
if (size > 0) {
jac_matrix->index[i] = (int *)malloc(size * sizeof(int));
Expand All @@ -452,8 +456,8 @@ void SD_allocJacMatrix(SD_jacMatrix jac_matrix)

void SD_cleanJacMatrix(SD_jacMatrix jac_matrix)
{
int i, variables = jac_matrix->variables;
for (i = 0; i < variables; i++) {
int variables = jac_matrix->variables;
for (int i = 0; i < variables; i++) {
if (jac_matrix->size[i] > 0) {
cleanDoubleVector(jac_matrix->value[i], 0, jac_matrix->size[i]);
}
Expand All @@ -462,13 +466,13 @@ void SD_cleanJacMatrix(SD_jacMatrix jac_matrix)

void SD_freeJacMatrix(SD_jacMatrix jac_matrix)
{
int i, variables = jac_matrix->variables;
int variables = jac_matrix->variables;
free(jac_matrix->size);
for (i = 0; i < variables; i++) {
for (int i = 0; i < variables; i++) {
free(jac_matrix->index[i]);
}
free(jac_matrix->index);
for (i = 0; i < variables; i++) {
for (int i = 0; i < variables; i++) {
free(jac_matrix->value[i]);
}
free(jac_matrix->value);
Expand Down
12 changes: 8 additions & 4 deletions src/engine/common/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <stdio.h>

#include <common/macros.h>
#include "utils.h"

typedef void (*SD_eq)(int, double *, double *, double *, double, double *);
Expand Down Expand Up @@ -158,7 +159,7 @@ void SD_freeEventData(SD_eventData events, int size);

void SD_cleanEventData(SD_eventData events, int size);

typedef struct SD_parameters_ *SD_parameters;
TYPE_DEF(SD_parameters)

struct SD_parameters_ {
double derDelta;
Expand All @@ -169,15 +170,18 @@ struct SD_parameters_ {
int lps; //!< Number of LPs defined for parallel simulations.
int nodeSize; //!< Node size used in the memory list for output simulation values.
int jacobian;
int CVODE_max_order;
SD_PartitionMethod pm; //!< Partition method used to obtain a model partition for parallel simulations.
SD_DtSynch dtSynch; //!< \f $ \delta t $ \f synchronization policy.
SD_partitionerOptions partitionerOptions;
int x_output;
};

SD_parameters SD_Parameters(double derDelta, double zcHyst, double minStep, int symDiff, int lps, int nodeSize, SD_PartitionMethod pm,
double dt, SD_DtSynch synch, SD_partitionerOptions partitionerOptions, int jacobian);
double dt, SD_DtSynch synch, SD_partitionerOptions partitionerOptions, int jacobian, int CVODE_max_order,
int x_output);

SD_parameters SD_copyParameters(SD_parameters parameters);
SD_parameters SD_copyParameters(const_SD_parameters parameters);

void SD_freeParameters(SD_parameters params);

Expand All @@ -204,7 +208,7 @@ SD_outputVariable SD_OutputVariable(int outputs);

void SD_freeOutputVariable(SD_outputVariable variable);

typedef struct SD_output_ *SD_output;
TYPE_DEF(SD_output)

struct SD_output_ {
char *name;
Expand Down
Loading

0 comments on commit 1de237c

Please sign in to comment.