Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,82 @@ jobs:
--output-on-failure \
2>&1 | tee logfile2

- name: Check log for Errors
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cat logfile2
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
if grep -q "$OUTPUT" logfile2; then
exit 0
fi
exit 1

examples:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4

- name: Install Valgrind
run: sudo apt-get update && sudo apt-get install valgrind

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake All
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug

- name: Build All
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --parallel

- name: Test cpp example
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
valgrind \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
-s \
./bin/call_highs_from_cpp \
--timeout 1000 \
--output-on-failure \
2>&1 | tee logfile2

- name: Check log for Errors
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cat logfile2
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
if grep -q "$OUTPUT" logfile2; then
exit 0
fi
exit 1

- name: Test C example
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
valgrind \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
-s \
./bin/call_highs_from_c_minimal \
--timeout 1000 \
--output-on-failure \
2>&1 | tee logfile2

- name: Check log for Errors
working-directory: ${{runner.workspace}}/build
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions examples/call_highs_from_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,7 @@ int main() {
cout << endl;
}

highs.resetGlobalScheduler(true);

return 0;
}
13 changes: 12 additions & 1 deletion highs/interfaces/highs_c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ HighsInt Highs_lpCall(const HighsInt num_col, const HighsInt num_row,
if (copy_row_basis) row_basis_status[i] = (HighsInt)basis.row_status[i];
}
}

highs.resetGlobalScheduler(true);

return (HighsInt)status;
}

Expand Down Expand Up @@ -104,6 +107,8 @@ HighsInt Highs_mipCall(const HighsInt num_col, const HighsInt num_row,
}
}

highs.resetGlobalScheduler(true);

return (HighsInt)status;
}

Expand Down Expand Up @@ -160,12 +165,18 @@ HighsInt Highs_qpCall(
if (copy_row_basis) row_basis_status[i] = (HighsInt)basis.row_status[i];
}
}

highs.resetGlobalScheduler(true);

return (HighsInt)status;
}

void* Highs_create(void) { return new Highs(); }

void Highs_destroy(void* highs) { delete (Highs*)highs; }
void Highs_destroy(void* highs) {
Highs::resetGlobalScheduler(true);
delete (Highs*)highs;
}

const char* Highs_version(void) { return highsVersion(); }
HighsInt Highs_versionMajor(void) { return highsVersionMajor(); }
Expand Down
Loading