Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce compiler warnings for C++ #6189

Open
hcho3 opened this issue Sep 30, 2020 · 22 comments
Open

Reduce compiler warnings for C++ #6189

hcho3 opened this issue Sep 30, 2020 · 22 comments
Assignees

Comments

@hcho3
Copy link
Collaborator

@hcho3 hcho3 commented Sep 30, 2020

Currently, the C++ compiler generates lots of warnings: https://xgboost-ci.net/blue/organizations/jenkins/xgboost/detail/master/516/pipeline/61. It would be great to reduce the number of warnings.

Note to new contributors: Post a comment here if you'd like to work on this issue. Feel free to ping me for help.

@sgavil
Copy link
Contributor

@sgavil sgavil commented Oct 1, 2020

Hello, i would like to work on this issue!

@hcho3
Copy link
Collaborator Author

@hcho3 hcho3 commented Oct 1, 2020

@sgavil Great! I'm going to assign this issue to you. Keep in mind that you don't have to eliminate all warnings in a single pull request. It will probably take several pull requests to address all warnings.

@hcho3
Copy link
Collaborator Author

@hcho3 hcho3 commented Oct 1, 2020

See instructions for building XGBoost here: https://xgboost.readthedocs.io/en/latest/build.html#building-on-linux-distributions. Modify the CMake flags as follows:

cmake .. -DENABLE_ALL_WARNINGS=ON

in order to show all compiler warnings.

@sgavil
Copy link
Contributor

@sgavil sgavil commented Oct 1, 2020

Great! Thank you

@vcarpani
Copy link
Contributor

@vcarpani vcarpani commented Oct 4, 2020

I can also contribute to this, I believe there are enough warnings for 2 different PRs

@igormp
Copy link
Contributor

@igormp igormp commented Oct 5, 2020

Mind if I jump into that too? GPU-related code has way too many warnings, would be nice to clean up some.

@hcho3
Copy link
Collaborator Author

@hcho3 hcho3 commented Oct 6, 2020

@igormp Great! Yes, your pull request is welcome! Keep in mind that some compiler warnings in the GPU code come from CUB and Thrust, so you may also consider submitting pull request there.

@igormp
Copy link
Contributor

@igormp igormp commented Oct 12, 2020

I've noticed that most warnings (I'd say half of those) come from dmlc, so maybe some PRs would be welcome there.

@hcho3
Copy link
Collaborator Author

@hcho3 hcho3 commented Oct 12, 2020

@igormp Yes, the compiler warning has been an issue for a while in dmlc. Would you like to take a shot?

@igormp
Copy link
Contributor

@igormp igormp commented Oct 13, 2020

Sure! It'll try to go through it during this week.

@BurakBarlas
Copy link

@BurakBarlas BurakBarlas commented Oct 19, 2020

Hi, Can I try to help you in this issue?

@hcho3
Copy link
Collaborator Author

@hcho3 hcho3 commented Oct 21, 2020

@BurakBarlas Yes! Feel free to submit a pull request. Let me know if you need help.

@pranav-verma001
Copy link

@pranav-verma001 pranav-verma001 commented Jan 27, 2021

Hello i want to work on this...

@trivialfis
Copy link
Member

@trivialfis trivialfis commented Jan 29, 2021

@pranav-verma001 Thanks for volunteering, you can start with #6189 (comment) . Feel free to ping me if you need any assistance. ;-)

@trivialfis
Copy link
Member

@trivialfis trivialfis commented Jan 29, 2021

@pranav-verma001 I'm not familiar with vscode IDE (I thought that's an editor instead of IDE?).

As for which compiler should you use, both gcc and clang are fine. Could you please try running the following steps in a terminal inside the xgboost directory:

mkdir build
cd build
cmake .. -DENABLE_ALL_WARNINGS=ON
make -j$(nproc)

@pranav-verma001
Copy link

@pranav-verma001 pranav-verma001 commented Jan 29, 2021

@pranav-verma001
Copy link

@pranav-verma001 pranav-verma001 commented Jan 29, 2021

@trivialfis
Copy link
Member

@trivialfis trivialfis commented Jan 29, 2021

@pranav-verma001 It seems like you are using Windows?

@pranav-verma001
Copy link

@pranav-verma001 pranav-verma001 commented Jan 29, 2021

@trivialfis
Copy link
Member

@trivialfis trivialfis commented Jan 29, 2021

Got it.

Assuming you have git installed in full, and you have visual studio IDE, you should have an option Git Bash Here in your right click menu in the source code directory. Open it, then type:

mkdir build
cd build
cmake .. -DCMAKE_CONFIGURATION_TYPE=Debug -A x64
cmake --build ./ --config Debug

@RAMitchell might be able to provide better suggestion. I only use Windows to debug compiler specific error ...

@giladmaya
Copy link
Contributor

@giladmaya giladmaya commented Mar 11, 2021

@trivialfis can I pitch in as well?

@trivialfis
Copy link
Member

@trivialfis trivialfis commented Mar 12, 2021

Sure! Let me know if you need any help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants