Skip to content

Commit

Permalink
fixing some compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BDonnot committed Apr 2, 2024
1 parent a57e599 commit 2676c62
Show file tree
Hide file tree
Showing 19 changed files with 262 additions and 60 deletions.
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ jobs:
make
CC=gcc python setup.py build
python -m pip install .[test]
- run:
name: "Show package versions"
command: |
source venv_test/bin/activate
pip freeze
- run:
name: "make tests"
command: |
Expand Down Expand Up @@ -380,6 +385,11 @@ jobs:
make
CC=clang python setup.py build
CC=clang python -m pip install -e .[test]
- run:
name: "Show package versions"
command: |
source venv_test/bin/activate
pip freeze
- run:
name: "make tests"
command: |
Expand Down Expand Up @@ -418,6 +428,7 @@ jobs:
git submodule update
python setup.py build
python -m pip install -e .[test]
pip freeze
- run:
name: "make tests"
command: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ jobs:
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: lightsim2grid-wheel-win-${{ matrix.config.name }}-${{ matrix.python.name }}
name: lightsim2grid-wheel-win-${{ matrix.python.name }}
path: dist/*.whl

macos_build_37:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ Change Log
- maybe have a look at suitesparse "sliplu" tools ?
- easier building (get rid of the "make" part)

[0.8.1] 2024-xx-yy
[0.8.2] 2024-xx-yy
--------------------
- [FIXED] CI was broken after migration to artifact v4, set it back to v3
(and make the names of the folder clearer)
- [IMPROVED] remove some compilation warnings for clang

[0.8.1] 2024-03-26
--------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Lightsim2grid 0.8.1 and grid2op 1.10.0
Lightsim2grid 0.8.1 and grid2op 1.10.1
======================================

l2rpn_case14_sandbox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Lightsim2grid 0.8.1 and grid2op 1.10.0
Lightsim2grid 0.8.1 and grid2op 1.10.1
======================================

l2rpn_case14_sandbox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Lightsim2grid 0.8.1 and grid2op 1.10.0 (python 3.11)
Lightsim2grid 0.8.1 and grid2op 1.10.1 (python 3.11)
====================================================

l2rpn_case14_sandbox
Expand Down
150 changes: 150 additions & 0 deletions docs/benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
Lightsim2grid 0.8.1 and grid2op 1.10.1 (python 3.12)
====================================================

l2rpn_case14_sandbox
---------------------

Configuration:

- date: 2024-03-26 13:42 CET
- system: Linux 5.4.0-153-generic
- OS: ubuntu 20.04
- processor: Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz
- python version: 3.12.2.final.0 (64 bit)
- numpy version: 1.26.4
- pandas version: 2.2.1
- pandapower version: 2.13.1
- grid2op version: 1.10.1
- lightsim2grid version: 0.8.1
- lightsim2grid extra information:

- klu_solver_available: True
- nicslu_solver_available: True
- cktso_solver_available: True
- compiled_march_native: True
- compiled_o3_optim: True

==================== ====================== =================================== ============================
case14_sandbox grid2op speed (it/s) grid2op 'backend.runpf' time (ms) solver powerflow time (ms)
==================== ====================== =================================== ============================
PP 31.3 28.9 16.8
GS 716 0.502 0.393
GS synch 696 0.522 0.41
NR single (SLU) 912 0.196 0.0829
NR (SLU) 911 0.197 0.084
NR single (KLU) 971 0.133 0.023
NR (KLU) 973 0.132 0.0213
NR single (NICSLU *) 955 0.136 0.023
NR (NICSLU *) 952 0.135 0.0213
NR single (CKTSO *) 970 0.132 0.0216
NR (CKTSO *) 975 0.13 0.0199
FDPF XB (SLU) 961 0.145 0.0355
FDPF BX (SLU) 949 0.158 0.0491
FDPF XB (KLU) 968 0.137 0.0285
FDPF BX (KLU) 957 0.15 0.0412
FDPF XB (NICSLU *) 963 0.139 0.0295
FDPF BX (NICSLU *) 943 0.154 0.0429
FDPF XB (CKTSO *) 971 0.138 0.0291
FDPF BX (CKTSO *) 956 0.151 0.0416
==================== ====================== =================================== ============================

Differences:

============================ ============== ============== ================
case14_sandbox (1000 iter) Δ aor (amps) Δ gen_p (MW) Δ gen_q (MVAr)
============================ ============== ============== ================
PP (ref) 0 0 0
GS 0.000122 7.63e-06 7.63e-06
GS synch 0.000122 7.63e-06 7.63e-06
NR single (SLU) 0.000122 7.63e-06 7.63e-06
NR (SLU) 0.000122 7.63e-06 7.63e-06
NR single (KLU) 0.000122 7.63e-06 7.63e-06
NR (KLU) 0.000122 7.63e-06 7.63e-06
NR single (NICSLU *) 0.000122 7.63e-06 7.63e-06
NR (NICSLU *) 0.000122 7.63e-06 7.63e-06
NR single (CKTSO *) 0.000122 7.63e-06 7.63e-06
NR (CKTSO *) 0.000122 7.63e-06 7.63e-06
FDPF XB (SLU) 0.000122 7.63e-06 7.63e-06
FDPF BX (SLU) 0.000122 7.63e-06 7.63e-06
FDPF XB (KLU) 0.000122 7.63e-06 7.63e-06
FDPF BX (KLU) 0.000122 7.63e-06 7.63e-06
FDPF XB (NICSLU *) 0.000122 7.63e-06 7.63e-06
FDPF BX (NICSLU *) 0.000122 7.63e-06 7.63e-06
FDPF XB (CKTSO *) 0.000122 7.63e-06 7.63e-06
FDPF BX (CKTSO *) 0.000122 7.63e-06 7.63e-06
============================ ============== ============== ================
l2rpn_neurips_2020_track2_small
---------------------------------

Configuration:

- date: 2024-03-26 13:51 CET
- system: Linux 5.4.0-153-generic
- OS: ubuntu 20.04
- processor: Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz
- python version: 3.12.2.final.0 (64 bit)
- numpy version: 1.26.4
- pandas version: 2.2.1
- pandapower version: 2.13.1
- grid2op version: 1.10.1
- lightsim2grid version: 0.8.1
- lightsim2grid extra information:

- klu_solver_available: True
- nicslu_solver_available: True
- cktso_solver_available: True
- compiled_march_native: True
- compiled_o3_optim: True

===================== ====================== =================================== ============================
neurips_2020_track2 grid2op speed (it/s) grid2op 'backend.runpf' time (ms) solver powerflow time (ms)
===================== ====================== =================================== ============================
PP 28.1 32.3 20.4
GS 4.05 245 245
GS synch 29.4 33 32.9
NR single (SLU) 519 0.9 0.754
NR (SLU) 518 0.917 0.771
NR single (KLU) 763 0.293 0.151
NR (KLU) 770 0.28 0.139
NR single (NICSLU *) 777 0.279 0.139
NR (NICSLU *) 774 0.27 0.127
NR single (CKTSO *) 792 0.27 0.13
NR (CKTSO *) 786 0.26 0.119
FDPF XB (SLU) 700 0.406 0.268
FDPF BX (SLU) 688 0.431 0.294
FDPF XB (KLU) 725 0.36 0.223
FDPF BX (KLU) 719 0.376 0.24
FDPF XB (NICSLU *) 730 0.351 0.215
FDPF BX (NICSLU *) 732 0.365 0.229
FDPF XB (CKTSO *) 748 0.343 0.209
FDPF BX (CKTSO *) 729 0.367 0.232
===================== ====================== =================================== ============================
Differences:

================================= ============== ============== ================
neurips_2020_track2 (1000 iter) Δ aor (amps) Δ gen_p (MW) Δ gen_q (MVAr)
================================= ============== ============== ================
PP (ref) 0 0 0
GS 6.1e-05 3.81e-06 1.53e-05
GS synch 6.1e-05 3.81e-06 1.53e-05
NR single (SLU) 6.1e-05 0 9.54e-07
NR (SLU) 6.1e-05 0 9.54e-07
NR single (KLU) 6.1e-05 0 9.54e-07
NR (KLU) 6.1e-05 0 9.54e-07
NR single (NICSLU *) 6.1e-05 0 9.54e-07
NR (NICSLU *) 6.1e-05 0 9.54e-07
NR single (CKTSO *) 6.1e-05 0 9.54e-07
NR (CKTSO *) 6.1e-05 0 9.54e-07
FDPF XB (SLU) 6.1e-05 1.91e-06 1.53e-05
FDPF BX (SLU) 6.1e-05 1.91e-06 7.63e-06
FDPF XB (KLU) 6.1e-05 1.91e-06 1.53e-05
FDPF BX (KLU) 6.1e-05 1.91e-06 7.63e-06
FDPF XB (NICSLU *) 6.1e-05 1.91e-06 1.53e-05
FDPF BX (NICSLU *) 6.1e-05 1.91e-06 7.63e-06
FDPF XB (CKTSO *) 6.1e-05 1.91e-06 1.53e-05
FDPF BX (CKTSO *) 6.1e-05 1.91e-06 7.63e-06
================================= ============== ============== ================
14 changes: 11 additions & 3 deletions docs/benchmarks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,24 @@ The results can be found in:
:maxdepth: 1
:caption: For a laptop with a i7 of 2015 wth a frequency of 2.70 GHz

benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.0
benchmark_solver/ubuntu_2004_dell/ls0.8.1_glop1.10.1
benchmark_solver/ubuntu_2004_dell/ls0.8.0_glop1.10.0
benchmark_solver/ubuntu_2004_dell/ls0.8.0_glop1.9.8

.. toctree::
:maxdepth: 1
:caption: For a laptop with a i7 of 2014 wth a frequency of 3.0 GHz

benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0
benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.0_py311
benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1
benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py311
benchmark_solver/ubuntu_2004_server/ls0.8.1_glop1.10.1_py312

.. note::
Any contribution here is more than welcomed. You can write a github discussion here
https://github.com/BDonnot/lightsim2grid/discussions/new?category=show-and-tell
and describe rapidly your setup and we'll make sure to include your benchmark in future release.

Thanks !

Benchmarks of other lightsim2grid functions
--------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Benjamin DONNOT'

# The full version, including alpha/beta/rc tags
release = "0.8.1"
release = "0.8.2.dev0"
version = '0.8'

# -- General configuration ---------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion lightsim2grid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
# This file is part of LightSim2grid, LightSim2grid implements a c++ backend targeting the Grid2Op platform.
__version__ = "0.8.1"

__version__ = "0.8.2.dev0"

__all__ = ["newtonpf", "SolverType", "ErrorType", "solver", "compilation_options"]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pybind11.setup_helpers import Pybind11Extension, build_ext


__version__ = "0.8.1"
__version__ = "0.8.2.dev0"
KLU_SOLVER_AVAILABLE = False

# Try to link against SuiteSparse (if available)
Expand Down
34 changes: 17 additions & 17 deletions src/GridModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,23 +986,23 @@ void GridModel::remove_gen_slackbus(int gen_id){
}

/** GRID2OP SPECIFIC REPRESENTATION **/
void GridModel::update_bus_status(int nb_bus_before,
Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, 2, Eigen::RowMajor> > active_bus)
{
for(int bus_id = 0; bus_id < active_bus.rows(); ++bus_id)
{
if(active_bus(bus_id, 0)){
reactivate_bus(bus_id);
}else{
deactivate_bus(bus_id);
}
if(active_bus(bus_id, 1)){
reactivate_bus(bus_id + nb_bus_before);
}else{
deactivate_bus(bus_id + nb_bus_before);
}
}
}
// void GridModel::update_bus_status(int nb_bus_before,
// Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, 2, Eigen::RowMajor> > active_bus)
// {
// for(int bus_id = 0; bus_id < active_bus.rows(); ++bus_id)
// {
// if(active_bus(bus_id, 0)){
// reactivate_bus(bus_id);
// }else{
// deactivate_bus(bus_id);
// }
// if(active_bus(bus_id, 1)){
// reactivate_bus(bus_id + nb_bus_before);
// }else{
// deactivate_bus(bus_id + nb_bus_before);
// }
// }
// }

void GridModel::update_gens_p(Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, Eigen::RowMajor> > has_changed,
Eigen::Ref<Eigen::Array<float, Eigen::Dynamic, Eigen::RowMajor> > new_values)
Expand Down
16 changes: 14 additions & 2 deletions src/GridModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,13 @@ class GridModel : public GenericContainer
real_type get_computation_time() const{ return _solver.get_computation_time();}
real_type get_dc_computation_time() const{ return _dc_solver.get_computation_time();}

// private:
// using GenericContainer::update_bus_status; // to silence clang warnings (overload-virtual)
// public:
// void update_bus_status(int nb_bus_before,
// Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, 2, Eigen::RowMajor> > active_bus);
// part dedicated to grid2op backend, optimized for grid2op data representation (for speed)
// this is not recommended to use it outside of its intended usage within grid2op !
void update_bus_status(int nb_bus_before,
Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, 2, Eigen::RowMajor> > active_bus);
void update_gens_p(Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, Eigen::RowMajor> > has_changed,
Eigen::Ref<Eigen::Array<float, Eigen::Dynamic, Eigen::RowMajor> > new_values);
void update_sgens_p(Eigen::Ref<Eigen::Array<bool, Eigen::Dynamic, Eigen::RowMajor> > has_changed,
Expand Down Expand Up @@ -659,10 +662,16 @@ class GridModel : public GenericContainer
}

//for FDPF
private:
using GenericContainer::fillBp_Bpp; // silence clang warning overload-virtual
public:
void fillBp_Bpp(Eigen::SparseMatrix<real_type> & Bp,
Eigen::SparseMatrix<real_type> & Bpp,
FDPFMethod xb_or_bx) const;

private:
using GenericContainer::fillBf_for_PTDF; // silence clang warning overload-virtual
public:
void fillBf_for_PTDF(Eigen::SparseMatrix<real_type> & Bf, bool transpose=false) const;

Eigen::SparseMatrix<real_type> debug_get_Bp_python(FDPFMethod xb_or_bx){
Expand Down Expand Up @@ -714,6 +723,9 @@ class GridModel : public GenericContainer
const Eigen::VectorXi & slack_bus_id_me,
Eigen::VectorXi & slack_bus_id_solver
);
private:
using GenericContainer::fillYbus; // to silence the overload-virtual warning in clang
protected:
void fillYbus(Eigen::SparseMatrix<cplx_type> & res, bool ac, const std::vector<int>& id_me_to_solver);
void fillSbus_me(CplxVect & res, bool ac, const std::vector<int>& id_me_to_solver);
void fillpv_pq(const std::vector<int>& id_me_to_solver,
Expand Down
1 change: 1 addition & 0 deletions src/batch_algorithm/BaseBatchSolverSynch.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class BaseBatchSolverSynch
}

BaseBatchSolverSynch(const BaseBatchSolverSynch&) = delete;
virtual ~BaseBatchSolverSynch() = default; // to avoid warning about overload virtual

// solver "control"
void change_solver(const SolverType & type){
Expand Down
Loading

0 comments on commit 2676c62

Please sign in to comment.