Enabled CUDA 12 C++20 w/ CMake, but .cu files cannot import ixx modules - cmake

Thanks to this answer, CUDA 12 C++20 support with CMake not working, I have .cu files building with C++20 using CMake and Visual Studio 2022.
However, when I import a C++ module in a .cu file, it gives an error: "catastrophic error : could not find module file for module"
Are C++20 modules supported in CUDA 12? I cannot find examples anywhere.
It is also possible that I need to modify the CMake configuration, but I'm not sure what needs to be done.

Quoting the CUDA 12.0 documentation:
Modules are not supported in CUDA C++, in either host or device code. Uses of the module, export and import keywords are diagnosed as errors.

Related

How to make a single, cross-platform EXE file in Python 3.7

I've tried PyInstaller, but it doesn't support Python 3.7. I'm using Python 3.7 features, so I don't want to downgrade to 3.6. How can I make my program a single-file, cross-platform executable?
Have you tried to use cx_Freeze? For Python 3.7, you need to apply the bugfix described in this answer by hand to your local cx_Freeze installation until a corrected version has been released.
cx_Freeze itself does not support building a single-file executable, but you can use further tools for this purpose as described here.
This depends on what you mean by "EXE file".
If you can jam all your source code into a single.py file then that would likely be the closest to a cross platform executable. It would just require having a python interpreter pre-installed on each OS.
If you are referring to a literal .exe executable file that works cross platform; for python programs this is impossible. Python compiles down to machine code in the same way that C and C++ do, which is platform specific. Unlike Java, which runs on a VM, if you wish to compile your python program into a single executable file, then the file will only work on whatever platform it was compiled on.

Compile Tensorflow programs with custom compiler

I'm trying to compile a very simple Tensorflow program (which only prints the Tensorflow version) with my company's c compiler but the libtensorflow.so I downloaded from Tensorflow's offical website is incompatible with our c compiler.
My company's c compiler is pretty much just a standard gcc but gcc can compile the program and our custom compiler cannot.
My colleague told me I have two options: (1) replace Bazel's compiler with our compiler and use Bazel to compile the program or (2) Compile the program with Bazel first then compile the program using our compiler and include the pb.h files generated by Bazel (because those bazel files can only be generated by Bazel).
I'm not sure how to do (!) but I tried (2). The problem with (2) is I got erros saying the protoc was generated by an older version and I'm not sure how to change to the right version.
Some additional information: (1) The OS is Linux, (2) I do not have the privilege to use sudo commands, (3) I cannot access system directories (e.g. /usr/local)
Is there any hope I can make this work? You may ask why not just build the program with Bazel. It's because our company's program needs to be run by our company's simulator and the simulator only accepts program generated by our company's compiler.
Your only option is to build tensorflow with Bazel, and tell Bazel to use your C/C++ compiler. The easiest way is to set the CC and CXX environment variables to point to your compiler's executable. If it is really a drop-in replacement of GCC, then it should work and after building you should get a tensorflow binary compiled with your custom compiler.
If special flags are needed then you should make a custom toolchain in Bazel to tell it how to use your compiler, it is a bit complex but not much. Instructions for that are at https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain

Undefined symbols for architecture x86_64 for mac

I used podofo library for mac application development, while building demo app i am getting following errors.
The error messages seem to indicate that you are working with static libraries (.a libraires). So, when building your demo app, you need to link with all the librairies needed, including the ones needed by freetype and fontconfig. These are bz2, z, crypto (from the openssl distribution) and others...
If Podofo is built with cmake, you can look at the CMakeCache.txt file. It contains the path where each library Podofo depends on was found on your system.
The bz2 library is not listed in the CMakeCache.txt. It is there by default, so you may just add
-lbz2
to the "Other Linker Flags" in your Xcode project build settings.

Errors building PCL 1.8 with VTK-7.0.0

Trying to build PCL 1.8 using VTK 7.0.0. Target is Visual Studio 2015.
Using the VTK OpenGL2 backend I got errors similar to those reported here and here which indicate OpenGL2 is not supported for PCL yet.
However, using the original VTK OpenGL backend I get different errors:
The list of VTK libraries PCL projects link against includes libraries whose names suggest both OpenGL and OpenGL2, even though VTK is only configured with one or the other backend. For example, "vtkDomainsChemistryOpenGL2.lib" (when VTK backend is OpenGL).
"vtkDomainsChemistryOpenGL2.lib" does not exist, causing a linker error. However, a library called "vtkDomainsChemistryOpenGL2-7.0.lib" exists, so it appears a version suffix is added when VTK is built, but is not added when CMake generates the list of libraries to link PCL projects with.
vtkVertexBufferObject.cxx(104): error C2039: 'GetExtensionManager': is not a member of 'vtkOpenGLRenderWindow'. Class vtkOpenGLRenderWindow is suspiciously tagged with VTKRENDERINGOPENGL2_EXPORT (again in an OpenGL build).
I don't know whether the problem lies in VTK or PCL. The CMake build system is completely opaque to me so I am getting nowhere with this.
Just following up to myself (again)...
The problem was that, because I had initially built the "INSTALL" project of VTK using the OpenGL2 backend, then changed the backend to OpenGL and built the "INSTALL" project of VTK again, both backends existed in the install folder. VTKConfig.cmake (which PCL uses to link with VTK) finds and links against all modules that it finds in the install folder, thus attempting to link against both incompatible backends.
The VTK build system does not detect that conflicting modules are already present when installing, and the "make clean" or "rebuild" options don't remove conflicting modules (VTK does not have an uninstaller). Deleting CMake caches, or creating a new clean build directory, is not sufficient to clear up this mess.
So the only solution was to manually find and delete the VTK install folder ("C:\Program Files (x86)\VTK", for the record) if you need to change the VTK backend.

How can I install MPFI library in Windows?

there!
I'd like to execute example program, Surface_reconstruction_points_3.
I think the program needs additionally 3rd library, MPFI.
So I downloaded the library from http://mpfi.gforge.inria.fr/.
And I unzipped it at proper folder and linked it to the system path.
After configurating the example program using cmake-gui,
I found some error message, 'Could NOT find MPFI (missing: MPFI_LIBRARIES)'.
How can I install MPFI library in Window using visual studio 2008?
Since MPFI is a GNU library, it is completely supported on Windows.
CGAL provides this third-party libraries inside its installation, but Windows has its own replacement.
I installed this correctly with Visual Studio, but you need to uncheck those third-party libraries so CGAL won't mess with the own windows replacements.
Maybe doing this kind of installation isn't working well for all the sample codes inside the installation, but it works fine for development. I used CGAL without those third-libraries for Voronoi and 2D and 3D triangulation and it works fine.
For a clean installation, delete all you installed previously, make sure the new installation isn't messing with the bad previous installation.
EDIT:
About not using those optional libraries for Windows, I just received a similar mail through the CGAL mailing list and these could be the steps for newer versions of CGAL (>4.2):
You have to comment 3 lines in the CMake machinery:
In CGAL-4.1/CMakeList.txt you have to comment:
#list (INSERT CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES 0 GMP MPFR)
#hide_variable(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES)
In CGAL-4.1/cmake/modules/UseCGAL.cmake you have to comment:
#use_essential_libs()
On the other hand, you can search on internet for precompiled versions of MPFI. For instance, you can find precompiled GMP, MPFR and MPFI for Windows on http://vegas.loria.fr/rs/ .