Do I need icc if I want to use ifort with f2py - f2py

I have Intel FORTRAN and want to use ifort to make a FORTRAN extension with f2py. I get an error message and was wondering whether this is because I need icc (Intel C compiler) as well.
Incidentally, f2py finds the compiler:
Found executable /usr/local/bin/ifort
But then throws an error ending with
File "/anaconda3/lib/python3.7/site-packages/numpy/distutils/fcompiler/init.py", line 430, in get_version
raise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound

Turns out the fcompiler needs to be specified as --fcompiler=intelem for 64 bit.
Now I get other errors on FORTRAN code that worked with gfortran on Python 3.6, but that is a different question.

Related

How to use cython console in Spyder?

I have a very simple question:
I failed to find any tutorial on using the Spyder cython console. How should be the cython code used?
On the official site only states that "A Cython console allows you to use the Cython language to speed up your code and call C functions directly from Python." But how?
Following this tutorial I tried to run the setup.py, the hello.pyx, and got errors when trying %cython, %%cython, or cdef in .py or .ipy files.
.c or .cpp files cannot be run at all.
Moreover, when I try to run a file containing simply print("bum") or a = 1 in cython console, nothing happens (it works when written directely to the console).
Many thanks for a little push.

Octave 'wavread' undefined

I have GNU Octave 5.2.0, and I want to use it to analyze the IQ data in a wav file. This link describes a function called wavread which I can use in Octave, but when I run y = wavread(filename), I get this error message:
error: 'wavread' undefined near line 1 column 1
Why do I get this? My best guess is that wavread is deprecated for some reason and only exists in earlier versions. My other guess is that I have to install an extension to use wavread, but I didn't find a source that allows me to do this.
As discovered by #TasosPapastylianou, the wavread function is deprecated as of Octave version 5. Solution is to use audioread function.

How to link cusparse using CMakeLists.txt

How can I add the cusparse library from CUDA in a CMakeLists.txt-file, such that the nvcc compiler includes it automatically with -lcusparse? I already added the line
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-lcusparse)
in CMakeLists.txt with no success. It looks like I'm missing something, because Nsight throws the error
undefined reference to 'cusparseDestroyMatDescr'.
Although when I exclude this line where cusparseDestroyMatDescr is called via commenting it, the Nsight project builds with no error, even with these three lines of code included
cusparseStatus_t status;
cusparseHandle_t handle=0;
cusparseMatDescr_t descr=0;
So it looks like it knows what cusparseStatus_t and so on is, but it does not know what cusparseDestroyMatDescr is.
What do I miss?
The correct way in CMake to link a library is using
target_link_libraries( target library ).
If you use FindCUDA to locate the CUDA installation, the variable CUDA_cusparse_LIBRARY will be defined. Thus, all you need to do is
target_link_libraries( target ${CUDA_cusparse_LIBRARY} )
I recommend to use the CMake CUDAToolkit package, which is available with CMake 3.17 and newer:
find_package(CUDAToolkit REQUIRED)
...
target_link_libraries(target CUDA::cusparse)

VS 2015 compiling cocos2d-x 3.6 error Macro definition of snprintf conflicts with Standard Library function declaration

I compile cocos2d-x(version 3.6) using visual studio 2015, the error occurred, saying:
fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration
Almost the same question like this link
here
I try to follow the first answer and then search most results on cocos forum but also failed, I'm noob and really have no idea now ..
And here it's my source code where defined snprintf on header file stdio.h
#if defined snprintf
// This definition of snprintf will generate "warning C4005: 'snprintf': macro
// redefinition" with a subsequent line indicating where the previous definition
// of snprintf was. This makes it easier to find where snprintf was defined.
#pragma warning(push, 1)
#pragma warning(1: 4005)
#define snprintf Do not define snprintf as a macro
#pragma warning(pop)
#error Macro definition of snprintf conflicts with Standard Library function declaration
#endif
Could someone help me .. thanks!
I am getting the same error trying to build libsndfile-1. I solved it by building using VS2013 instead of VS2015. (I think it should be possible to simply install VS2013 Build Tools and build from VS2015).
edit: to install the VS2013 build toolset, run the VS2015 installer and select 'Windows 8.1 and Windows Phone 8.0/8.1 Tools'

MinGW Main routine

In C there is no main program. Sure, C programmers begin with int main(int argc char *argv[]), but this only works because there is a routine that tells the compiler/IDE to run the function named main first.
I can't seem to find this routine in MinGW, though. Where is it defined? I just searched because I wanted to change it (only as a test) and play around with it a bit. Can someone link me to the correct file in the MinGW folders?
The ld linker will look for a match of one of several symbols to use as the entry point when linking a PE file:
entry point subsystem
--------------------- --------------
NtProcessStartup native
WinMainCRTStartup Windows GUI
mainCRTStartup Windows CUI (console)
__PosixProcessStartup POSIX CUI
WinMainCRTStartup WinCE GUI
mainCRTStartup Xbox
mainCRTStartup other
DllMainCRTStartup#12 (or possibly DllMainCRTStartup) for DLLs
MinGW will have an object file that gets automatically linked in that has the actual PE entry point. - you can see what object files are being automatically linked in by using gcc's -v option.
In a quick test using MinGW 4.6.1 building a console subsystem "hello world" program, the object file containing the entry point is crt2.o and it has a symbol mainCRTStartup that is picked up by the linker as the entry point.
The source file containing the entrypoint code is crtexe.c (or crtdll.c).
You can override the entry point using the --entry option to the linker (Wl,--entry=whatever when used on the gcc command line).