Open MPI and gfortran require different compiler flags? - openmpi

I have a serial program that uses the ssyevr lapack routine to diagonalize matricies. It runs fine but is a little slow. Recently, I downloaded OpenMPI through MacPorts with the intention of utilizing the dual core processor (with shared memory) to decrease run time.
My program calculates an average of some quantity, so I'd like to run half of my ensemble on one process and the other half on the other process. I require minor communication between each process (mpi_reduce and mpi_barrier to combine the data at the end).
I figured that linking to -llapack would work as with the serial program but found I needed to link -lblas and -latlas when using mpifort to compile my program.
If I don't add flags for blas and atlas I get the following error:
Undefined symbols for architecture x86_64:
"_ATL_cGetNB", referenced from:
_ATL_ilaenv in liblapack.a(ATL_ilaenv.o)
"_ATL_dGetNB", referenced from:
_ATL_ilaenv in liblapack.a(ATL_ilaenv.o)
"_ATL_sGetNB", referenced from:
_ATL_ilaenv in liblapack.a(ATL_ilaenv.o)
"_ATL_zGetNB", referenced from:
_ATL_ilaenv in liblapack.a(ATL_ilaenv.o)
"_cblas_scopy", referenced from:
_ATL_slarfb in liblapack.a(ATL_slarfb.o)
"_cblas_sdot", referenced from:
_ATL_slarftFC.part.0 in liblapack.a(ATL_slarft.o)
_ATL_slarftFR.part.2 in liblapack.a(ATL_slarft.o)
_ATL_slarftBC.part.1 in liblapack.a(ATL_slarft.o)
_ATL_slarftBR.part.3 in liblapack.a(ATL_slarft.o)
_ATL_slarftFC in liblapack.a(ATL_slarft.o)
_ATL_slarftBC in liblapack.a(ATL_slarft.o)
_ATL_slarftFR in liblapack.a(ATL_slarft.o)
...
"_cblas_sgemm", referenced from:
_ATL_slarfb in liblapack.a(ATL_slarfb.o)
_ATL_slarft_blockFC in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockFR in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockBC in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockBR in liblapack.a(ATL_slarft.o)
"_cblas_strmm", referenced from:
_ATL_slarfb in liblapack.a(ATL_slarfb.o)
_ATL_slarft_blockFC in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockFR in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockBC in liblapack.a(ATL_slarft.o)
_ATL_slarft_blockBR in liblapack.a(ATL_slarft.o)
"_isamax_", referenced from:
_sstein_ in liblapack.a(sstein.o)
"_lsame_", referenced from:
_ssyevr_ in liblapack.a(ssyevr.o)
_ilaenv_ in liblapack.a(ilaenv.o)
_slansy_ in liblapack.a(slansy.o)
_sormtr_ in liblapack.a(sormtr.o)
_sstebz_ in liblapack.a(sstebz.o)
_sstemr_ in liblapack.a(sstemr.o)
_ssytrd_ in liblapack.a(ssytrd.o)
...
"_saxpy_", referenced from:
_sstein_ in liblapack.a(sstein.o)
_slatrd_ in liblapack.a(slatrd.o)
_ssytd2_ in liblapack.a(ssytd2.o)
"_scopy_", referenced from:
_ssyevr_ in liblapack.a(ssyevr.o)
_sstein_ in liblapack.a(sstein.o)
_sstemr_ in liblapack.a(sstemr.o)
_slarre_ in liblapack.a(slarre.o)
_slarrv_ in liblapack.a(slarrv.o)
_slarrf_ in liblapack.a(slarrf.o)
"_sdot_", referenced from:
_sstein_ in liblapack.a(sstein.o)
_slatrd_ in liblapack.a(slatrd.o)
_ssytd2_ in liblapack.a(ssytd2.o)
"_sgemv_", referenced from:
_slatrd_ in liblapack.a(slatrd.o)
_slarf_ in liblapack.a(slarf.o)
"_sger_", referenced from:
_slarf_ in liblapack.a(slarf.o)
"_snrm2_", referenced from:
_sstein_ in liblapack.a(sstein.o)
_slarfg_ in liblapack.a(slarfg.o)
"_sscal_", referenced from:
_ssyevr_ in liblapack.a(ssyevr.o)
_sstein_ in liblapack.a(sstein.o)
_sstemr_ in liblapack.a(sstemr.o)
_slarrv_ in liblapack.a(slarrv.o)
_slatrd_ in liblapack.a(slatrd.o)
_slarfg_ in liblapack.a(slarfg.o)
"_sswap_", referenced from:
_ssyevr_ in liblapack.a(ssyevr.o)
_sstemr_ in liblapack.a(sstemr.o)
"_ssymv_", referenced from:
_slatrd_ in liblapack.a(slatrd.o)
_ssytd2_ in liblapack.a(ssytd2.o)
"_ssyr2_", referenced from:
_ssytd2_ in liblapack.a(ssytd2.o)
"_ssyr2k_", referenced from:
_ssytrd_ in liblapack.a(ssytrd.o)
"_xerbla_", referenced from:
_ssyevr_ in liblapack.a(ssyevr.o)
_sormtr_ in liblapack.a(sormtr.o)
_sstebz_ in liblapack.a(sstebz.o)
_sstein_ in liblapack.a(sstein.o)
_sstemr_ in liblapack.a(sstemr.o)
_ssterf_ in liblapack.a(ssterf.o)
_ssytrd_ in liblapack.a(ssytrd.o)
...
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
I've gotten this error many times before. It happens when you forget to link a library. The error reads as
"_This_routine" was called within the routine:
_That_routine in this_library.a(That_routine.o)
That_routine, was found in the library this_library and it called a routine "This_routine" that could not be found. All of the routines missing are found in either BLAS or ATLAS. So therefore using their compiler flags will solve the issue.
Normally, I'd just be happy and move on but my code does not run successfully despite these changes and I have good reason to believe that the parallelized version is not bugged. I have run it with success on Sharcnet (Which may not be using the same version !!!).
Edit: When I run mpifort --showme I get
/opt/local/bin/gfortran-mp-7 -I/opt/local/include/openmpi-mp -Wl,-flat_namespace -Wl,-commons,use_dylibs -I/opt/local/lib/openmpi-mp -L/opt/local/lib -L/opt/local/lib/openmpi-mp -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi
I'm not really sure what it tells me.

Related

facing error like cound not find any definition of shared libraries in github actions

please find the below screenshot. can you please help me how to resolve this error
ERROR: Could not find any definition of libraries [https://github.com/venky-patikineti/jenkinsdemo/plat-saasa-lib-ITX-76593#master]
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: Loading libraries failed
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)

Why unused namespace defined in xaml file breaks generation of protobuf files?

i have simple WPF project to demonstrate my issue
this is my build log
Rebuild started...
1>------ Rebuild All started: Project: WpfApp, Configuration: Debug Any CPU ------
Restored d:\projects\GrpcError\WpfApp\WpfApp.csproj (in 6 ms).
1>d:\projects\GrpcError\WpfApp\MainWindow.xaml.cs(2,14,2,20): error CS0234: The type or namespace name 'Protos' does not exist in the namespace 'WpfApp' (are you missing an assembly reference?)
1>Done building project "WpfApp_khdt0wpw_wpftmp.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
funny part is that visual studio (2022) correctly navigates to generated file (d:\projects\GrpcError\WpfApp\obj\Debug\net6.0-windows\Protos\Login.cs) with namespace WpfApp.Protos.Core defined ...
i managed to track this error to MainWindow.xaml file -
compilation will be successfull if i remove this line: xmlns:local="clr-namespace:WpfApp"
any idea why is this happening?

How to link static library depending on a shared library with CMake

I want to use static library(libglog.a) not shared with my heartbeat app.
The glog lib(https://github.com/google/glog) I used is depends on unwind lib refer by this link Why a static library can depend on a shared a library?
I also encountered this problem too ! #Ke Yang
But I am new to CMake, I don' know how to link unwind.so please?
Here is my CMakeLists.txt
include_directories(
${CMAKE_CURRENT_LIST_DIR}
)
link_directories(
)
add_executable( heartbeat
main.cpp
heartbeat.cpp
${COMPONENTS_SRC}
${MODULES_SRC}
)
target_link_libraries( heartbeat
libpthread.a
libcrypt.a
libm.a
libgflags.a
libglog.a
libhiredis.a
libredis++.a
)
# 输出到build文件夹上层目录
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/..)
Then I get this ERROR
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libglog.a(libglog_la-utilities.o):在函数‘google::GetStackTrace(void**, int, int) [clone .part.7]’中:
(.text+0xad):对‘_Ux86_64_getcontext’未定义的引用
(.text+0xb8):对‘_ULx86_64_init_local’未定义的引用
(.text+0xe7):对‘_ULx86_64_step’未定义的引用
(.text+0x100):对‘_ULx86_64_get_reg’未定义的引用
(.text+0x120):对‘_ULx86_64_step’未定义的引用
collect2: error: ld returned 1 exit status

crashs on android L when load so

I have a skia shared library generated from skia source code, i want use it to draw something in my cpp file. This project runs well on android M and N, but it crashed on android L.
This is my CMakeList.txt
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
set(libs "${CMAKE_SOURCE_DIR}/src/main/jniLibs")
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/android)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/atlastext)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/c)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/codec)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/config)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/core)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/effects)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/encode)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/gpu)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/pathops)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/ports)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/private)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/svg)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/utils)
include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/include/views)
#--------------------------------------------------- import ---------------------------------------------------#
add_library(libmyskia SHARED IMPORTED )
set_target_properties(libmyskia PROPERTIES
IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libmyskia.so")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fexceptions -fno-rtti")
add_library(eskia
SHARED
src/main/cpp/eskia.cpp )
find_library( android-lib
android)
target_link_libraries(eskia
libmyskia
${android-lib}
)
I load the library in my activity:
static {
System.loadLibrary("myskia");
System.loadLibrary("eskia");
}
Here is the crash info, has anyone meet this?
04-02 16:46:55.319 21449-21449/com.eastedu.skiaandroid E/art: dlopen("/data/app/com.eastedu.skiaandroid-2/lib/arm/libeskia.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "_ZTVN10__cxxabiv117__class_type_infoE" referenced by "libeskia.so"...
04-02 16:46:55.319 21449-21449/com.eastedu.skiaandroid D/AndroidRuntime: Shutting down VM
04-02 16:46:55.319 21449-21449/com.eastedu.skiaandroid E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.eastedu.skiaandroid, PID: 21449
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZTVN10__cxxabiv117__class_type_infoE" referenced by "libeskia.so"...
at java.lang.Runtime.loadLibrary(Runtime.java:383)
at java.lang.System.loadLibrary(System.java:997)
at com.eastedu.skiaandroid.MainActivity.<clinit>(MainActivity.java:17)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1606)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2535)
at android.app.ActivityThread.access$1200(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1387)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5689)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at enter code herecom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

MsXml6 failing to link properly

Hello I am trying to use msxml and I am getting a linker (VS 2012) error and can't figure out why.
My class file has the following header declaration:
#include <MsXml6.h>
class Foo
{
....
private:
static IXMLDOMDocument* document;
};
I then reference the document with the following (which gives the link error):
CoCreateInstance(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&document);
I have the project setup to link against msxml6.lib. The logs are as follows:
Searching C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64\msxml6.lib:
1> Found IID_IXMLDOMDocument
1> Referenced in Foo.obj
1> Loaded msxml6.lib(msxml6_i.obj)
...
1>Foo.obj : error LNK2001: unresolved external symbol "private: static struct IXMLDOMDocument * Foo::document" (?document#Foo##0PEAUIXMLDOMDocument##EA)
1>Some.exe : fatal error LNK1120: 1 unresolved externals
Is there something important I am missing? Let me know if you need more info.
Thanks!
I found the problem, I forgot to declare the document variable in the source file.

Resources