Skip to content
Permalink
Browse files

dcp: style edits to chunk/block size options

Signed-off-by: Adam Moody <moody20@llnl.gov>
  • Loading branch information...
adammoody committed Jun 11, 2019
1 parent e559ef1 commit 1ef8681b2d62958539f2baedc978d27e9ec346d0
Showing with 48 additions and 42 deletions.
  1. +1 −1 doc/rst/dcp.1.rst
  2. +7 −5 src/dcp/dcp.c
  3. +40 −36 src/dcp1/dcp1.c
@@ -15,7 +15,7 @@ dcp is a file copy tool in the spirit of :manpage:`cp(1)` that evenly
distributes the work of scanning the directory tree, and copying file
data across a large cluster without any centralized state. It is
designed for copying files that are located on a distributed parallel
file system, and will split large file copies across multiple processes.
file system, and it splits large file copies across multiple processes.

OPTIONS
-------
@@ -112,10 +112,10 @@ int main(int argc, char** argv)
int option_index = 0;
static struct option long_options[] = {
{"blocksize" , required_argument, 0, 'b'},
{"chunksize" , required_argument, 0, 'k'},
{"debug" , required_argument, 0, 'd'}, // undocumented
{"grouplock" , required_argument, 0, 'g'}, // untested
{"input" , required_argument, 0, 'i'},
{"chunksize" , required_argument, 0, 'k'},
{"preserve" , no_argument , 0, 'p'},
{"synchronous" , no_argument , 0, 's'},
{"sparse" , no_argument , 0, 'S'},
@@ -142,9 +142,10 @@ int main(int argc, char** argv)
switch(c) {
case 'b':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS || bytes == 0) {
if (rank == 0)
if (rank == 0) {
MFU_LOG(MFU_LOG_ERR,
"Failed to parse block size: '%s'\n", optarg);
"Failed to parse block size: '%s'", optarg);
}
usage = 1;
} else {
mfu_copy_opts->block_size = (size_t)bytes;
@@ -210,9 +211,10 @@ int main(int argc, char** argv)
break;
case 'k':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS || bytes == 0) {
if (rank == 0)
if (rank == 0) {
MFU_LOG(MFU_LOG_ERR,
"Failed to parse chunk size: '%s'\n", optarg);
"Failed to parse chunk size: '%s'", optarg);
}
usage = 1;
} else {
mfu_copy_opts->chunk_size = bytes;
@@ -264,15 +264,15 @@ void DCOPY_print_usage(void)
printf(" dcp [options] source ... target_dir\n");
printf("\n");
printf("Options:\n");
printf(" -b, --blocksize - IO buffer size in bytes (default 1MB)\n");
/* printf(" -c, --compare - read data back after writing to compare\n"); */
printf(" -d, --debug <level> - specify debug verbosity level (default info)\n");
printf(" -f, --force - delete destination file if error on open\n");
printf(" -k, --chunksize - work size per task in bytes (default 1MB)\n");
printf(" -p, --preserve - preserve permissions, ownership, timestamps, extended attributes\n");
printf(" -s, --synchronous - use synchronous read/write calls (O_DIRECT)\n");
printf(" -v, --verbose - verbose output\n");
printf(" -q, --quiet - quiet output\n");
printf(" -s, --synchronous - use synchronous read/write calls (O_DIRECT)\n");
printf(" -k, --chunksize - work size per task in bytes (default 1MB)\n");
printf(" -b, --blocksize - IO buffer size in bytes (default 1MB)\n");
printf(" -h, --help - print usage\n");
printf("\n");
printf("Level: dbg,info,warn,err,fatal\n");
@@ -339,25 +339,36 @@ int main(int argc, \

static struct option long_options[] = {
{"blocksize" , required_argument, 0, 'b'},
{"chunksize" , required_argument, 0, 'k'},
{"compare" , no_argument , 0, 'c'},
{"debug" , required_argument, 0, 'd'},
{"force" , no_argument , 0, 'f'},
{"help" , no_argument , 0, 'h'},
{"chunksize" , required_argument, 0, 'k'},
{"preserve" , no_argument , 0, 'p'},
{"verbose" , no_argument , 0, 'v'},
{"quiet" , no_argument , 0, 'q'},
{"unreliable-filesystem", no_argument , 0, 'u'},
{"synchronous" , no_argument , 0, 's'},
{"verbose" , no_argument , 0, 'v'},
{"quiet" , no_argument , 0, 'q'},
{"help" , no_argument , 0, 'h'},
{0 , 0 , 0, 0 }
};

/* Parse options */
unsigned long long bytes;
while((c = getopt_long(argc, argv, "cb:d:fhpusvqk:", \
while((c = getopt_long(argc, argv, "b:cd:fk:pusvqh", \
long_options, &option_index)) != -1) {
switch(c) {

case 'b':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS) {
if (DCOPY_global_rank == 0) {
fprintf(stderr, "Failed to convert -b: %s\n", optarg);
}
DCOPY_exit(EXIT_FAILURE);
}
DCOPY_blocksize = (size_t)bytes;

break;

case 'c':
DCOPY_user_opts.compare = true;

@@ -433,13 +444,15 @@ int main(int argc, \

break;

case 'h':

if(DCOPY_global_rank == 0) {
DCOPY_print_usage();
case 'k':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS) {
if (DCOPY_global_rank == 0) {
fprintf(stderr, "Failed to convert -k: %s\n", optarg);
}
DCOPY_exit(EXIT_FAILURE);
}
DCOPY_chunksize = (size_t)bytes;

DCOPY_exit(EXIT_SUCCESS);
break;

case 'p':
@@ -451,14 +464,6 @@ int main(int argc, \

break;

case 'v':
mfu_debug_level = MFU_LOG_VERBOSE;
break;

case 'q':
mfu_debug_level = MFU_LOG_NONE;
break;

case 'u':
DCOPY_user_opts.reliable_filesystem = false;

@@ -478,24 +483,23 @@ int main(int argc, \

break;

case 'k':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS) {
if (DCOPY_global_rank == 0) {
fprintf(stderr, "Failed to convert -k: %s\n", optarg);
DCOPY_exit(EXIT_FAILURE);
}
}
DCOPY_chunksize = (size_t)bytes;
case 'v':
mfu_debug_level = MFU_LOG_VERBOSE;
break;
case 'b':
if (mfu_abtoull(optarg, &bytes) != MFU_SUCCESS) {
if (DCOPY_global_rank == 0) {
fprintf(stderr, "Failed to convert -b: %s\n", optarg);
DCOPY_exit(EXIT_FAILURE);
}

case 'q':
mfu_debug_level = MFU_LOG_NONE;
break;

case 'h':

if(DCOPY_global_rank == 0) {
DCOPY_print_usage();
}
DCOPY_blocksize = (size_t)bytes;

DCOPY_exit(EXIT_SUCCESS);
break;

case '?':
default:

0 comments on commit 1ef8681

Please sign in to comment.
You can’t perform that action at this time.