Re: [petsc-dev] Is there a reason for short arch and host names?
(((MOAR) PARENTHESES)) One would think you were a Lisper. On Jul 27, 2012 6:05 PM, "Barry Smith" <[email protected]> wrote:
I absolutely hate sizeof arch. That is one of the most perverse things people can do in C. What is wrong with good-old sizeof(arch)?
Needs to go in the PETSc style guide :-)
Barry
On Jul 27, 2012, at 2:35 PM, Jed Brown wrote:
I'm sick of truncated PETSC_ARCH in log_summary. Does anyone object to my pushing the following to petsc-3.3? Should we just make all the fields huge so we're guaranteed to get everything? Since pname can be as long as PETSC_MAX_PATH_LEN, this is not a line we can reasonably limit/align.
--- a/src/sys/plog/plog.c +++ b/src/sys/plog/plog.c @@ -1269,7 +1269,7 @@ PetscStageInfo *stageInfo = PETSC_NULL; PetscEventPerfInfo *eventInfo = PETSC_NULL; PetscClassPerfInfo *classInfo; - char arch[10], hostname[64], username[16], pname[PETSC_MAX_PATH_LEN], date[64]; + char arch[64], hostname[128], username[16], pname[PETSC_MAX_PATH_LEN], date[64]; const char *name; PetscLogDouble locTotalTime, TotalTime, TotalFlops; PetscLogDouble numMessages, messageLength, avgMessLen, numReductions; @@ -1311,12 +1311,12 @@ ierr = PetscFPrintf(comm, fd, "*** WIDEN YOUR WINDOW TO 120 CHARACTERS. Use 'enscript -r -fCourier9' to print this document ***\n");CHKERRQ(ierr); ierr = PetscFPrintf(comm, fd, "************************************************************************************************************************\n");CHKERRQ(ierr); ierr = PetscFPrintf(comm, fd, "\n---------------------------------------------- PETSc Performance Summary: ----------------------------------------------\n\n");CHKERRQ(ierr); - ierr = PetscGetArchType(arch, 10);CHKERRQ(ierr); - ierr = PetscGetHostName(hostname, 64);CHKERRQ(ierr); - ierr = PetscGetUserName(username, 16);CHKERRQ(ierr); + ierr = PetscGetArchType(arch,sizeof arch);CHKERRQ(ierr); + ierr = PetscGetHostName(hostname,sizeof hostname);CHKERRQ(ierr); + ierr = PetscGetUserName(username,sizeof username);CHKERRQ(ierr); ierr = PetscGetProgramName(pname, PETSC_MAX_PATH_LEN);CHKERRQ(ierr); - ierr = PetscGetDate(date, 64);CHKERRQ(ierr); - ierr = PetscGetVersion(version,256);CHKERRQ(ierr); + ierr = PetscGetDate(date,sizeof date);CHKERRQ(ierr); + ierr = PetscGetVersion(version,sizeof version);CHKERRQ(ierr); if (size == 1) { ierr = PetscFPrintf(comm,fd,"%s on a %s named %s with %d processor, by %s %s\n", pname, arch, hostname, size, username, date);CHKERRQ(ierr); } else {
participants (1)
-
Jed Brown