Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

levatin1
Copy link
Collaborator

Did not implement -w and -r yet, but added a -n for number of files.

Did not implement -w and -r yet, but added a -n for number of files.
@levatin1
Copy link
Collaborator Author

Adam or anyone:

  Please test dfilemaker with a few options.  Thanks.

JoAnne

@levatin1 levatin1 closed this Apr 25, 2019
@gonsie gonsie reopened this Apr 25, 2019
@adammoody
Copy link
Member

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);
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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);
Copy link
Member

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.

@adammoody
Copy link
Member

Thanks, @levatin1 . Coming along nicely. I added a few comments just about fixing up the style to match the rest of the code.

@adammoody
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants