6

I was trying to compile a very simple MPI hello_world:

#include <stdio.h>
#include <mpi.h>

int main(int argc, char *argv[]) {
    int numprocs, rank, namelen;
    char processor_name[MPI_MAX_PROCESSOR_NAME];

    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Get_processor_name(processor_name, &namelen);

    printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);

    MPI_Finalize();
}

And got the following problem:

    Catastrophic error: could not set locale "" to allow processing of multibyte characters

I really don't know how to figure it out.

4
  • Does the error message give a filename and/or line number? Does your source file have non-ASCII characters in it? Is your source file encoded in UTF-16? Commented Nov 14, 2012 at 19:26
  • Is that compiler error? Which line does it come from? Or is it runtime error, presumably generated by MPI_Get_processor_name, since that's the only one handling strings? Does it disappear if you remove string stuff? Commented Nov 14, 2012 at 20:04
  • 1
    You're on Mac OSX? They had an issue with locales being unavailable, IIRC Commented Nov 14, 2012 at 20:38
  • You've shown all your code, but not your commands and not your full output. Commented Nov 14, 2012 at 20:39

2 Answers 2

19

Try defining environment variables

LANG=en_US.utf8
LC_ALL=en_US.utf8

Assuming you're on unix, also try man locale and locale -a at command line, and google for "utf locale" and similar searches.

Sign up to request clarification or add additional context in comments.

3 Comments

Yes, That is the problem. The issue is my computer LANG=UTF-8 and when I ssh to the remote server, the server's LANG changed!!!
@user1819905, UTF-8 is not a valid language specification. It should be something like en_US.UTF-8 or de_DE.UTF-8. And yes, it could be propagated to the server environment over SSH if the SSH client is configured to do so. The SSH client in 10.7+ is.
This works for me. Seems that I have different UTF encoding between my local machine and the remote server.
0

Re-defining the environment variable LANG solved the problem for me, as pointed out (setting LANG=en_US.utf8).

I may say that I'm conecting to a foreign server, and there's where I get the problem compiling code with Intel compilers.

1 Comment

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.