Run MPI program on desktop? - windows

I created a simple Hello World program to test MPI like described by Microsoft Code is:
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
printf("Hello");
int node;
// Initialize the MPI environment
MPI_Init(&argc, &argv);
// Get the rank of the process
MPI_Comm_rank(MPI_COMM_WORLD, &node);
// Print off a hello world message
printf("Hello world from node %d\n",node);
// Finalize the MPI environment.
MPI_Finalize();
}
Programs compiles without error:
But in order to get the program running i need smpd manager and mpiexec which is not part of the ms-mpi installation. And as my computer is running with windows 10 i'm unable to install Microsoft HPC. Is there a way to get a mpi program running on a desktop with several threads?

It's not the Microsoft HPC Pack needed to run MPI programs on desktops but the Microsoft HPC Pack SDK . Slight but important difference.

Related

Unable to profile simple C++ program in Instruments: "failed to execute loader thread"

I made a new command-line tool C++ project in Xcode, with the following main.cpp:
#include <iostream>
int main() {
std::cout << "Hello, World!\n";
}
When I try to profile it in Instruments with any template, I get the following error before my program even starts:
Failed to execute loader thread for /Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Resources/liboainject.dylib in target; target process <pid> likely exited
I get the same error when I try running Instruments with xctrace.
How do I get Instruments to properly load my programs?
Setup:
Xcode version: 13.4.1 (13F100)
Hardware: 2020 M1 MacBook Air

Error when openning built-in Macbook pro camera

I'm trying to read some frames from the built-in camera of a Macbook pro using opencv 4.1.0 with c++. Below is the code I have:
#include "opencv2/opencv.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <iostream>
#include <unistd.h>
using namespace cv;
using namespace std;
int main(int, char**) {
VideoCapture cap(0);
if(!cap.isOpened())
cerr<<"Error! unable to open camera!";
return -1;
cout << "Start grabbing" << endl
<< "Press any key to terminate" << endl;
Mat frame;
namedWindow("Live");
for (;;)
{
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
// check if we succeeded
if (frame.empty()) {
cerr << "ERROR! blank frame grabbed\n";
break;
}
// show live and wait for a key with timeout long enough to show images
imshow("Live", frame);
if (waitKey(5) >= 0)
break;
}
return 0;
}
When calling
VideoCapture cap(0);
the error I'm getting is:
testApp[11889:464240] +[AVCaptureDevice authorizationStatusForMediaType:]: unrecognized selector sent to class 0x7fff9f79cd50
[ERROR:0] VIDEOIO(AVFOUNDATION): raised unknown C++ exception!
I tried replacing 0 with other indices, but none of them work. Anyone know what is going on?
What version of macOS are you running on? I had the exact same issue but in Java. I solved it today by upgrading my OS from High Sierra to Mojave version 10.14 and updating the Xcode command line tools in the terminal using xcode-select --install.
I think the reason we got this problem is that Xcode command line tools - which provides the api (AVFoundation) to access camera on macOS and ios - was too old and therefore not compatible with the newly released OpenCV4.1.0. So my suggestion would be try to update your Xcode command line tools. In my case, I needed to upgrade my OS in order to get a newer version of it.
I had the same issue but in python. I wanted to access the webcam and capture images, but continued to get this error. What solved my problem was a simple SMC reset of the macbook.

Debug C++ console application in Qt Creator on Mac OS X

I wrote a simple console application, and tried to debug it. But when I start debugging, in application output appears this message: Run in Terminal is not supported with the LLDB backend..
I use Qt Creator 4.1.0 on Mac OS X 10.11.
Here is an example of code that I tried to debug:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
cin >> a;
cout << "a^2 = " << a * a;
return 0;
}
I also met this problem.
If I create a new C/C++ (Non-Qt project), the debugger doesn't work. However, if I create a Qt console project, the debugger works well.
There is the gdb debbugger wich is the GNU debbugger.
Here there is a tutorial

LLDB debugger never finishes in QtCreator

I am trying to use Qt Creator 3.5.1 to debug a piece of software I wrote. I noticed that whilst debugging my program would just halt at random points and I mistook these issues for threading problems. However, eventually I found out that even when I ran the simplest of programs the debugger would keep running for all eternity without finishing.
I am running on a Mac (El Capitan), with Qt 5.5.1 and Xcode 7.3.
This is my very simple test program:
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Howdy, this is a simple test program." << std::endl;
return 0;
}
When I run this in debugging mode in Qt Creator without setting any breakpoints it just never finishes:
Debugging starts
Howdy, this is a simple test program.
It is only when I press the stop button several times that the debugger comes back at me with Debugging has finished
When I look at the "Debugger log view" it shows me a Python exception of something crashing. I have no idea how to troubleshoot this though.
ERROR: Lldb stderr: Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/Users/Stan/Qt5.5.1/Qt Creator.app/Contents/Resources/debugger/lldbbridge.py", line 765, in loop
self.handleEvent(event)
File "/Users/Stan/Qt5.5.1/Qt Creator.app/Contents/Resources/debugger/lldbbridge.py", line 1383, in handleEvent
% self.hexencode(msg))
File "/Users/Stan/Qt5.5.1/Qt Creator.app/Contents/Resources/debugger/dumper.py", line 478, in hex encode
return s.encode("hex") eAttributeError: 'NoneType' object has no attribute 'encode'
It might be nothing, but I have quite a challenge on my hands right now and I'd rather not work with a debugger I can't trust.
Thanks.
Apparently, you can fix the problem directly by applying this patch in your Qt Creator's sources: https://codereview.qt-project.org/#/c/154748/
It worked for me.

file in/out error with CUDA 5.0

After downloading the latest toolkit and compiling/running the code that I currently have, I get a debug assertion error with any sort of file IO functions. Even the code below will exit with an assertion error when fprintf is called.
//main.cu
#include <stdio.h>
#include <stdlib.h>
int main ( void ) {
FILE* foo;
foo=fopen("C:\\asdfsa.txt","w");
fprintf(foo,"wtf\n");
fclose(foo);
return 0;
}
I am using CUDA toolkit 5.0, and Visual studio.
Any idea on what is going on? My code worked fine on my older computer with an old version cuda toolkit.
Check the fopen return value. Looks like you are running the code on the entirely new environmnent - maybe you can't create the file in the C:\ (e.g. this may require admin permissions)

Resources