Is it possible to use VSCode, linux, g++ to compile program using multiple CPU cores to speed up build? I mean it can compile multiple .cpp files at once to speed it up as Visual Studio does.
Related
I have a Fortran program(.f) that I have written in Ubuntu Linux. I compiled the written Fortran program in Linux by using the below command and it it successfully executed.
gfortran -o program program.f
Now I want to execute the same Fortran program in Windows 10 Can it be executed in window system? If so please suggest me a way to do it.
I tried gfortran -o program program.f in Windows command window,but it fails.
To compile Fortran code for Windows you need a Fortran compiler for Windows. Microsoft neither provides a built-in one nor offers one for sale. Third-party compilers are available, including gfortran, but you'll need to install one yourself. If you want to use gfortran in particular, or if you like it simply because you don't have to spend money to get it, then I would recommend obtaining it as part of mingw-w64. Alternatives are available from multiple vendors, some free of charge, but most for sale.
Note also that Windows expects executables to be named with an .exe extenstion, so you would want to use a variation on gfortran your compilation command:
gfortran -o program.exe program.f
If you want to use gfortran on Windows, I suggest you install MSYS2, which has a bash terminal, and a package manager that can install gcc and gfortran, as well as lapack and many other libraries.
There is also a separate distribution of mingw-w64 that can be installed without MSYS2, but I don't recommend it, as the last files there have gcc-8.1.0, from 2018 (apart from a recent build by Ray Linn that includes the Ada, but not the Fortran compiler).
Another compiler that is now free is Intel Fortran : you have to install Microsoft Visual Studio Community, Intel oneAPI Base Toolkit and Intel oneAPI HPC Toolkit. More information here. Available on Linux, macOS and Windows (of course, Visual Studio is needed only on Windows). Intel oneAPI is at least partly open source, not sure about the Fortran compiler.
MSYS2 is a much smaller package (in terms of disk pace needed), and is used by several other free projects: R (Rtools), Octave and Strawberry Perl all include parts of it, including the gcc compilers.
I have been working on getting a small staticly compiled program for ARM.
I have staticly compiled with two different compilers
https://uclibc.org/downloads/binaries/0.9.30.1/cross-compiler-armv5l.tar.bz2
(cross-compiler-armv5l/bin/armv5l-gcc)
and
gcc-arm-linux-gnueabi
Now, my question is, why does the gcc-arm-linux-gnueabi compile my program to over 400kb and the uclibc binaries compile my program to 30kb?
This is a HUGE size difference and I am wanting to compile in armv7l but I can't find any binaries like ulibc has. Is there a way to cross compile straight from gcc to create the same effect as the uclibc binaries.
These are the flags I use:
-s -O2 -static
If anyone could point me in the right direction as to how to cross compile gcc so that it isn't inflating my binary by 10 times it size that would be really helpful. Thanks!
I'm uing ARM_EABI cross-compiler to compile a code that makes use of pthreads to run at an ARM Cortex A9 simulation.
While I'm able to compile it with no problems (just as I've did with others non-pthread applications, which ran fine in the simulation), I'm having an error message when trying to run my pthread application at the simulated ARM (which is running Linux as OS). It's the following:
./pttest.exe: /lib/libpthread.so.0: no version information available (required by ./pttest.exe)
I did my research and found out that's because it's a dynamic lib, and I'm compiling the application with a higher version than the one available on my simulator.
My question is: how to find force my cross-compiler to compile the application with the same pthread lib version of my simulator? Is there anywhere I can download different versions of pthreads? And how to set it?
Sorry, I'm quite a newbie in that area.
Try compiling your application statically, e.g.
gcc -static -o myapplication myapplication.c
I wanted to compile botan library version Botan-1.10.1 on linux for 64-bit mode.
Please tell me steps for compiling the botan on linux in 64-bit mode.
The build instructions for botan can be found here:
http://botan.randombit.net/manual/building.html
Basically, you need to run ./configure. In theory, it should make an educated guess as to the CPU type, so if you are building on a 64bit machine, it should automagically configure itself accordingly. If not, you can help it along by specifiying the correct cpu type with
./configure --cpu
Botan automatically guesses your OS and architecture. However, you can set that manually if you want(For e.g., if you are targeting multiple platforms or using a script to run configure.py). To build for 64-bit you need to specify --cpu=x86_64:
python configure.py --cpu=x86_64
To disable certain os features use: --without-os-features=.
To specify compiler use: --cc= or --cc-bin=path/to/compiler
To get a single .h and .cpp file use: --amalgamation
To disable certain modules use: --disable-modules=aes, block
Further build instructions for botan can be found here or use --help to get more info:
http://botan.randombit.net/manual/building.html
I've spent a lot of time setting up the CUDA toolchain on a machine running Ubuntu Linux (11.04). The rig has two NVIDIA Tesla GPUs, and I'm able to compile and run test programs from the NVIDIA GPU Computing SDK such as deviceQuery, deviceQueryDrv, and bandwidthTest.
My problems arise when I try to compile basic sample programs from books and online sources. I know you're supposed to compile with NVCC, but I get compile errors whenever I use it. Basically any sort of include statement involving CUDA libraries gives a missing file/library error. An example would be:
#include <cutil.h>
Do I need some sort of makefile to direct the compiler to these libraries or are there additional flags I need to set when compiling with NVCC?
I followed these guides:
http://hdfpga.blogspot.com/2011/05/install-cuda-40-on-ubuntu-1104.html http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_C_Getting_Started_Linux.pdf
To fix the include problems add the cuda include directory to your compilation options (assuming it is /usr/local/cuda/include):
nvcc -I/usr/local/cuda/include -L/usr/local/cuda/lib test.cu -o test
cutil is not part of the CUDA toolkit. It's part of the CUDA SDK. So, assuming you have followed the instructions and you have added the PATH and LIB directories to your environment variables you still need to point to the CUDA SDK includes and libraries directories.
In order to include that lib manually you must pass the paths to the compiler:
nvcc -I/CUDA_SDK_PATH/C/common/inc -L/CUDA_SDK_PATH/C/lib ...
Although I personally prefer not to use the CUDA SDK libraries, you probably will find easier start a project from a CUDA SDK example.