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

no file 'libroom.cp37-win_amd64.pyx'? #238

Closed
pokjnb opened this issue Nov 1, 2021 · 10 comments
Closed

no file 'libroom.cp37-win_amd64.pyx'? #238

pokjnb opened this issue Nov 1, 2021 · 10 comments

Comments

@pokjnb
Copy link

pokjnb commented Nov 1, 2021

I found you use build_rir and libroom for c compile, only find 'build_rir.pyx', but no 'libroom.pyx',
Is the file missing? or did I misunderstand the mixed way?

@fakufaku
Copy link
Collaborator

fakufaku commented Nov 1, 2021

Hi @pokjnb , the libroom extension is not written in Cython, but in C++. The source is in pyroomacoustics/libroom_src. You can check out the doc for local build instructions.

@pokjnb
Copy link
Author

pokjnb commented Nov 2, 2021

@fakufaku Hi, Thanks for your reply, very efficient! I follow the Develop Locally part on the 'doc' page, and try the unit test with no errors, thanks!
What if I want to debug the files which are in the 'libroom_src' folder? like if I write an example and use function 'ray_tracing', and I want to debug this function in .cpp file(as this function is in the class 'room') and watch parameters' value changing, any advice?
Can I debug this in python IDE(Pycharm), or should I debug this in Visual studio? I haven't tried any mixed debug way like python plus C++, any instructions I can follow?

@fakufaku
Copy link
Collaborator

fakufaku commented Nov 2, 2021

@pokjnb , great you could get started! Now, this is an excellent question and I would like myself to know 😉 In theory, you should be able to use the C++ debugging tools (so, visual studio on win, etc), however, this requires the python interpreter to have been also compiled with the debugging symbols on, which is not the case for the major distributions (conda, etc). I have relied on code analysis and printing values for debugging 🙈 It's been a while since I explored options so you may be more lucky now... Sorry that I do not have a great answer.

@pokjnb
Copy link
Author

pokjnb commented Nov 2, 2021

@fakufaku Haha, thanks for sharing! You have done a lot of work! so it seems that firstly I need to remove conda's python.exe environment and use python official installing environment instead? Would that be better?

How do you transfer the parameters to the .cpp files? I imagine you use python IDE to set debug points in .cpp files if the python interpreter has debugging symbols on? mainly in python IDE or mainly in C++ IDE when you print values? or you use both? just can't imagine how did this happen! 🙈🙈

@fakufaku
Copy link
Collaborator

fakufaku commented Nov 2, 2021

Hum, I never got to have this working, so you are in uncharted territory! I am quite interested to know if you succeed though! I just found this link giving some pointers. It seems that the idea is to embed the Python interpreter in a test program...

@fakufaku
Copy link
Collaborator

fakufaku commented Nov 2, 2021

In my case I compile with the python setup.py build_ext --inplace command. Then use println or std::cout to print to standard output. The value printed will appear in the console of the IDE or terminal you are using to run the program.

@pokjnb
Copy link
Author

pokjnb commented Nov 2, 2021

@fakufaku Hum... seems much more work than I thought. Ok... I will google this issue as best as I can, if I have any progress, whatever succeeded or failed, I will comment here.
Thanks for your reply!

@pokjnb
Copy link
Author

pokjnb commented Nov 5, 2021

@fakufaku Hi, I wanna ask that all '.cpp' files in the libroom_src folder, you add them to pra module just by adding 'libroom.cpp' in 'setup', no other actions? (now I know that "setup.py build" can generate 'pyd' file directly)

@fakufaku
Copy link
Collaborator

fakufaku commented Nov 8, 2021

All the cpp files (header and source) need to be indicated in the setup.py file. I do that around line 45. Then, I create an Extension object where the compile options, etc, can be added.
This is not the only way to compile a python module. Some people use CMake, or you could do it without using the setuptools. Essentially, you have to compile as a shared library.

@pokjnb
Copy link
Author

pokjnb commented Jul 5, 2022

In my case I compile with the python setup.py build_ext --inplace command. Then use println or std::cout to print to standard output. The value printed will appear in the console of the IDE or terminal you are using to run the program.

After searching and trying many ways, I have to say your way is the most efficient, especially making links between two different code languages. For now, I have not found a compiler that can compile and mix debug without any pain. Although Microsoft developed mix debug many years ago, it still has many issues and is really easy to give up when trying. My lesson is not to spend much time on it. (sad face

@pokjnb pokjnb closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants