Skip to content

Commit 69a64ff

Browse files
authored
Merge pull request #1811 from borglab/fix/python_wrapper
Fix warnings and add M1 runner
2 parents 74b149f + b5c998a commit 69a64ff

File tree

10 files changed

+47
-25
lines changed

10 files changed

+47
-25
lines changed

.github/workflows/build-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656

5757
steps:
5858
- name: Checkout
59-
uses: actions/checkout@v3
59+
uses: actions/checkout@v4
6060

6161
- name: Install Dependencies
6262
run: |

.github/workflows/build-macos.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
2727
name: [
2828
macos-12-xcode-14.2,
29+
macos-14-xcode-15.4,
2930
]
3031

3132
build_type: [Debug, Release]
@@ -36,9 +37,14 @@ jobs:
3637
compiler: xcode
3738
version: "14.2"
3839

40+
- name: macos-14-xcode-15.4
41+
os: macos-14
42+
compiler: xcode
43+
version: "15.4"
44+
3945
steps:
4046
- name: Checkout
41-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4248

4349
- name: Install Dependencies
4450
run: |

.github/workflows/build-python.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
ubuntu-20.04-gcc-9-tbb,
3333
ubuntu-20.04-clang-9,
3434
macos-12-xcode-14.2,
35+
macos-14-xcode-15.4,
3536
windows-2022-msbuild,
3637
]
3738

@@ -59,13 +60,18 @@ jobs:
5960
compiler: xcode
6061
version: "14.2"
6162

63+
- name: macos-14-xcode-15.4
64+
os: macos-14
65+
compiler: xcode
66+
version: "15.4"
67+
6268
- name: windows-2022-msbuild
6369
os: windows-2022
6470
platform: 64
6571

6672
steps:
6773
- name: Checkout
68-
uses: actions/checkout@v3
74+
uses: actions/checkout@v4
6975

7076
- name: Install (Linux)
7177
if: runner.os == 'Linux'
@@ -162,6 +168,14 @@ jobs:
162168
run: |
163169
bash .github/scripts/python.sh -d
164170
171+
- name: Create virtual on MacOS
172+
if: runner.os == 'macOS'
173+
run: |
174+
python$PYTHON_VERSION -m venv venv
175+
source venv/bin/activate
176+
echo "PATH=$(pwd)/venv/bin:$PATH" >> $GITHUB_ENV
177+
python -m pip install --upgrade pip
178+
165179
- name: Install Python Dependencies
166180
shell: bash
167181
run: python$PYTHON_VERSION -m pip install -r python/dev_requirements.txt

.github/workflows/build-special.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383

8484
steps:
8585
- name: Checkout
86-
uses: actions/checkout@v3
86+
uses: actions/checkout@v4
8787

8888
- name: Install (Linux)
8989
if: runner.os == 'Linux'

.github/workflows/build-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
steps:
4646
- name: Checkout
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848

4949
- name: Setup msbuild
5050
uses: ilammy/msvc-dev-cmd@v1

gtsam/3rdparty/Eigen/Eigen/src/SparseCore/TriangularSolver.h

-2
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,9 @@ struct sparse_solve_triangular_sparse_selector<Lhs,Rhs,Mode,UpLo,ColMajor>
270270
}
271271

272272

273-
Index count = 0;
274273
// FIXME compute a reference value to filter zeros
275274
for (typename AmbiVector<Scalar,StorageIndex>::Iterator it(tempVector/*,1e-12*/); it; ++it)
276275
{
277-
++ count;
278276
// std::cerr << "fill " << it.index() << ", " << col << "\n";
279277
// std::cout << it.value() << " ";
280278
// FIXME use insertBack

gtsam/3rdparty/Eigen/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h

-5
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ void SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode (const Index n, IndexVe
7575
// Identify the relaxed supernodes by postorder traversal of the etree
7676
Index snode_start; // beginning of a snode
7777
StorageIndex k;
78-
Index nsuper_et_post = 0; // Number of relaxed snodes in postordered etree
79-
Index nsuper_et = 0; // Number of relaxed snodes in the original etree
8078
StorageIndex l;
8179
for (j = 0; j < n; )
8280
{
@@ -88,7 +86,6 @@ void SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode (const Index n, IndexVe
8886
parent = et(j);
8987
}
9088
// Found a supernode in postordered etree, j is the last column
91-
++nsuper_et_post;
9289
k = StorageIndex(n);
9390
for (Index i = snode_start; i <= j; ++i)
9491
k = (std::min)(k, inv_post(i));
@@ -97,7 +94,6 @@ void SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode (const Index n, IndexVe
9794
{
9895
// This is also a supernode in the original etree
9996
relax_end(k) = l; // Record last column
100-
++nsuper_et;
10197
}
10298
else
10399
{
@@ -107,7 +103,6 @@ void SparseLUImpl<Scalar,StorageIndex>::heap_relax_snode (const Index n, IndexVe
107103
if (descendants(i) == 0)
108104
{
109105
relax_end(l) = l;
110-
++nsuper_et;
111106
}
112107
}
113108
}

gtsam/3rdparty/metis/GKlib/pdb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ that structure.
131131
/************************************************************************/
132132
pdbf *gk_readpdbfile(char *fname) { /* {{{ */
133133
int i=0, res=0;
134-
char linetype[6];
134+
char linetype[7];
135135
int aserial;
136136
char aname[5] = " \0";
137137
char altLoc = ' ';

gtsam/discrete/tests/testDiscreteConditional.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ TEST(DiscreteConditional, choose) {
292292
/* ************************************************************************* */
293293
// Check argmax on P(C|D) and P(D), plus tie-breaking for P(B)
294294
TEST(DiscreteConditional, Argmax) {
295-
DiscreteKey B(2, 2), C(2, 2), D(4, 2);
295+
DiscreteKey C(2, 2), D(4, 2);
296296
DiscreteConditional B_prior(D, "1/1");
297297
DiscreteConditional D_prior(D, "1/3");
298298
DiscreteConditional C_given_D((C | D) = "1/4 1/1");

python/CMakeLists.txt

+20-11
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,27 @@ if(GTSAM_UNSTABLE_BUILD_PYTHON)
263263
endif()
264264

265265
# Add custom target so we can install with `make python-install`
266-
if (NOT WIN32) # WIN32=1 is target platform is Windows
267-
add_custom_target(python-install
268-
COMMAND stubgen -q -p gtsam -o ./stubs && cp -a stubs/gtsam/ gtsam && ${PYTHON_EXECUTABLE} -m pip install --user .
266+
# Note below we make sure to install with --user iff not in a virtualenv
267+
set(GTSAM_PYTHON_INSTALL_TARGET python-install)
268+
add_custom_target(${GTSAM_PYTHON_INSTALL_TARGET}
269+
COMMAND ${PYTHON_EXECUTABLE} -c "import sys, subprocess; cmd = [sys.executable, '-m', 'pip', 'install']; has_venv = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix); cmd.append('--user' if not has_venv else ''); cmd.append('.'); subprocess.check_call([c for c in cmd if c])"
269270
DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
270-
WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY})
271-
else()
272-
#TODO(Varun) Find equivalent cp on Windows
273-
add_custom_target(python-install
274-
COMMAND ${PYTHON_EXECUTABLE} -m pip install --user .
275-
DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
276-
WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY})
277-
endif()
271+
WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY}
272+
VERBATIM)
273+
274+
# if (NOT WIN32) # WIN32=1 is target platform is Windows
275+
# add_custom_target(${GTSAM_PYTHON_INSTALL_TARGET}
276+
# COMMAND stubgen -q -p gtsam -o ./stubs && cp -a stubs/gtsam/ gtsam && ${PYTHON_EXECUTABLE} -m pip install --user .
277+
# DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
278+
# WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY})
279+
# else()
280+
# #TODO(Varun) Find equivalent cp on Windows
281+
# add_custom_target(${GTSAM_PYTHON_INSTALL_TARGET}
282+
# COMMAND ${PYTHON_EXECUTABLE} -m pip install --user .
283+
# DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
284+
# WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY})
285+
# endif()
286+
278287

279288
# Custom make command to run all GTSAM Python tests
280289
add_custom_target(

0 commit comments

Comments
 (0)