-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modified code to take both short and long options. #269
base: main
Are you sure you want to change the base?
Conversation
Did not implement -w and -r yet, but added a -n for number of files.
Adam or anyone:
JoAnne |
Thanks @levatin1 . For the size parameters that take units, let's pass those to mfu_abtoull, which will parse a string like 1GB and return the number of bytes in an unsigned long long. You can see an example of it being used here: https://github.com/hpc/mpifileutils/blob/master/src/dfilemaker1/dfilemaker1.c#L49 Can you update the PR to drop the makefile and example run script. Those are useful to keep in your directory, but we'll keep them out of the repo. To keep those around so that you don't lose your own copies of them, first make a copy of each file (cp makefile makefile.bak), then run "git rm" on each file (git rm makefile), push your commit. Then you can copy them back if you'd like (cp makefile.bak makefile) |
Adam please check. This version gives repeatable results for different numbers of processors. With GB size files may have problem setting size term in elements of linked list to the value as it takes long long.
if (rank == 0) | ||
{ | ||
printf("Could not interpret %s as file size\n", minterm); | ||
fflush(stdout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For error messages, let's replace printf("") flush() with MFU_LOG(MFU_LOG_ERR, "")
@@ -566,6 +616,29 @@ int main(int narg, char** arg) | |||
int* lind; // list of ints in order to resort things | |||
int initsum, noff; | |||
|
|||
int kft=0,ifac=0; // kft is index of filltype | |||
unsigned long long sizeminl,sizemaxl; // for mfu_abtoul | |||
long int sizemin=0,sizemax=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For file sizes, let's store these as uint64_t to be consistent with the other tools.
if (jseed) iseed=jseed; | ||
break; | ||
case 'f': | ||
for (kft=0;kft<4;kft++) if (strcmp(optarg,filltype[kft])==0) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match style we're using in the code base, let's add braces to all for/if/while statements and place the code block indented on the following lines.
srand(iseed); | ||
if (nmax > 0) ntotal=nmin+rand()%(1+nmax-nmin); | ||
if (depmax > 0) nlevels=depmin+rand()%(1+depmax-depmin); | ||
if (sizemax > 0) maxflen=sizemin+rand()%(1+sizemax-sizemin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use braces and indentation here, too.
Thanks, @levatin1 . Coming along nicely. I added a few comments just about fixing up the style to match the rest of the code. |
Also, @levatin1 . For new commits that you push, we've added a check to make sure people have signed off. To do this, just add "-s" to your "git commit" step. |
Did not implement -w and -r yet, but added a -n for number of files.