luaL_newstate doesn't succeed under valgrind? - lua

I'm trying to debug some problems with a luajit based application under 64bit Linux.
The script calls back into a number of libraries via FFI and I'm trying to figure out some memory corruption issues. Valgrind is normally my tool of choice for this, however I've found that luaL_newstate fails when run under Valgrind.
After some poking around I found that standard luajit also fails to load. I think this might be more a problem with valgrind than luajit. Is there a way of giving valgrind more memory?

If you are using a version of valgrind starting with version 3.9.0 and up to (but not including) version 3.11.0 that is likely the problem.
Those versions appear to be "broken" on x86_64 with luajit.
See this email from Mike Pall:
[Note that Valgrind 3.9.0 has chosen to block MAP_32BIT, which
breaks LuaJIT on Linux/x64:
https://bugs.kde.org/show_bug.cgi?id=324181
Older versions of Valgrind still work. It wasn't that useful to
debug LuaJIT on x64, anyway, due to the mandatory use of the
builtin allocator. But none of that relates to your problem.]

Related

Why Cygwin has old Clang (v8)?

Are there any special reasons why Cygwin Clang is so outdated (see here), version 8, while already version 13 exists?
For example Ubuntu (apt), MSYS2, MSVC all have version 12.
Also does anyone know (any links?) if there is any very simple way (like docker-based) to build recent Clang for Cygwin? Maybe Clang has no support for Cygwin anymore, that's why Cygwin has outdated version?
See:
https://cygwin.com/packages/summary/clang.html
The reason is very simple, there is no current maintainer.
The previous one has no more available time to dedicate to the project.

How to solve`illegal instruction: 4` crash of elixir package

The jaxon elixir package crashes systematically on only one of my two macs even though they are running the same version of MacOS, XCode, clang, erlang and elixir.
Here is the more detailed bug report
How can I investigate this, or what other dependencies can I check to try to resolve this?
Your CPU could not handle the instructions it tries to execute.
Check the CPU model of your "MacPro 5,1", and whether it can handle AVX2 or other optimizations of the compiler.

Lua 5.4.0/LuaRocks installation

Hello,
I have been using Lua 5.1.2 since I begun learning Lua, and I wanted to upgrade to a more recent version, but there aren't any tutorial on how to do it, and I never did something similar. I downloaded the Lua 5.4.0 binaries, but I don't know how to install LuaRocks, which is really useful. (I don't know if this information is useful, but I'm using Windows 7)
Thank you.
so you got 5.4.0 installed?
https://github.com/luarocks/luarocks/wiki/Download
you probably want the 64-bit version of LuaRocks
if it complains, try the 32-bit instead.
just guessing, because most processors are 64-bit these days - unless it's something like a Raspberry Pi, but then you wouldn't be on Win7...

NVIDIA Nsight waring: OpenACC injection initialization failed. Is the PGI runtime version greater than 15.7?

I am trying to venture into accelerating my Fortran 2003 programs with OpenACC directives on my Ubuntu 18.04. workstation with Nvidia GeForce RTX 2070 card. To that end, I have installed Nvidia HPC-SDK version 20.7 which should comes with compilers I need (Fortran 2003 from Portland Group and Nvidia (both are version 20.7-0)) as well as profilers (nvprof and Nvidia Nsight Sytems (2020.3.1)).
After a few post-installation glitches, and owing mostly to the help from Robert Cravella (https://stackoverflow.com/users/1695960/robert-crovella) and Mat Colgrove (https://stackoverflow.com/users/3204484/mat-colgrove) I managed to get things going which made me very happy.
My workflow looks like this:
Compile my program:
pgfortran -acc -Minfo=accel -o my_program ./my_program.f90
I run it through profiler:
nsys profile ./my_program
And then import into nsight-sys with File -> Open and chose report1.qdrep
I believe this to be a proper workflow. However, while opening the report file, nsight-sys gives me the warning: "OpenACC injection initialization failed. Is the PGI runtime version greater than 15.7?" That's quite unfortunate, because I use OpenACC to accelerate my programs.
I am not quite sure what PGI runtime is, nor would I know how to check it or change it? I assume it is something with Portland Group (compiler), but I use the suite compilers shipped with Nvidia's HPC-SDK, so I wouldn't expect incompatibilities with the profiler tools shipped in the same package.
Is it an option, or possible at all, to update the PGI runtime thing?
And advice, please?
Cheers
Same answer as your previous post. There's a know issue with Nsight-Systems version 2020.3 which may sometimes cause an injection error when profiling OpenACC. I've been told that this was fixed in version 2020.4, hence the work around would be download and install 2020.4 or use a prior release.
https://developer.nvidia.com/nsight-systems
Version 2020.3 is what we shipped with the NVHPC 20.7 SDK. I'm not sure we have enough time to update to 2020.4 in our upcoming 20.9 release, but if not, we'll bundle it in a later release.
Thanks Mat,
In the meanwhile I managed to have everything running. I did as follows:
First installed CUDA toolkit, which came with the latest driver for my Nvidia RTX 2070 card, 11.1 to be precise. It needed a reboot, but that's OK. For CUDA toolkit to work, I had to set LD_LIBRARY_PATH to its libraries.
Then I installed Nvidia HPC-SDK, which I needed for Fortran 2003 compiler.
HPC-SDK is built for CUDA version 11.0 and comes with its own libraries and LD_LIBRARY_PATH should point to its libraries different from CUDA toolkit.
But, I kept the LD_LIBRARY_PATH to point to CUDA toolkit ones, and then compilers and profilers work in perfect harmony :-)
Thanks again, you and Robert helped me big time to get things running.

Is Clang as (or more) portable than gcc for C++?

Suppose I have a C++ project, and I compile it with gcc and with clang. You can assume that the gcc compiled version runs in another linux machine. Will this imply (in normal circumstances) that the clang version will also run on the other linux machine?
Clang binraries are as portable as gcc binaries are, as long as you are linking to the same libraries and you aren't passing flags like -march=native to the compiler.
Clang has one huge advantage over gcc, it can deal with alsmost all libstdc++ versions,
while gcc is bound to its bundled version and often can't parse any older versions.
So the following often happens in production environments:
Install an LTS distro (Ubuntu 12.04 for example)
Keep gcc, glibc and libstdc++ untouched
Install a recent clang version for C++11, etc
Build the release binaries with clang
So (in my specific example) those binaries will work on all
distros with libstdc++ >= 4.6 and glibc >= 2.15.
This may be an interesting read for you.
If the program is a simple Hello world, it should work on the other machine when compiled through Clang.
But when the program is a real program with a lot a lines and compilation units, and calls to many external libs everything is possible depending on the program itself and the compilation options :
hardware requirements (memory) being different (mainly depends on compilation options)
use of different (versions of) libraries between gcc and clang
UB giving expected results in one and not in the other
different usages for implementation defined rules
use of gcc extensions not accepted by clang
For all of the above except 2 first, it should run on other machines it it runs on one
linux programs depend on their build environment. If your glibc version or kernel is different there will be lots of possibilities that the executable will not be able to run. You could use the interpreter language of llvm though, it compiles into bytecode which can be interpreted on various operating systems.
The answer is, well, depends.
The first hard requirement is the same CPU architecture. 64 Bit is not enough of a qualifier. If you compile of x64 you won't have much success running it on 64-Bit ARM.
The next big one is libraries. If you use any libraries in the program, the target system needs to have those libraries. This includes the kernel headers. So if you compile for e.g. a current kernel version, using the most cutting-edge features, then you will have no joy running that program on a very old version of Linux.
The last one is hardware dependencies. If you create a program that e.g. requires 4 GB of RAM and then try to run it on a small embedded device with 256 MB RAM, that won't work either.
To fit better to your changed question: From my experience there shouldn't be much of a difference in portability between Clang and gcc. Also googling didn't turn up anything, so it should basically work. But better always test stuff like that before you publish some binary in production.

Resources