Skip to content

Commit

Permalink
Update the copyright and cleanup the code.
Browse files Browse the repository at this point in the history
Per @jsquyres suggestion remove all trailing spaces.
Credit to `sed -i.bak 's/ *$//' */[ch]`.
  • Loading branch information
bosilca committed Mar 28, 2016
1 parent 9206249 commit f69eba1
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 204 deletions.
29 changes: 4 additions & 25 deletions contrib/build-mca-comps-outside-of-tree/btl_tcp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "ompi/mca/mpool/base/base.h"
#include "ompi/mca/mpool/mpool.h"
#include "btl_tcp.h"
#include "btl_tcp_frag.h"
#include "btl_tcp_frag.h"
#include "btl_tcp_proc.h"
#include "btl_tcp_endpoint.h"

Expand Down Expand Up @@ -61,7 +61,7 @@ mca_btl_tcp2_module_t mca_btl_tcp2_module = {
mca_btl_tcp2_send,
NULL, /* send immediate */
mca_btl_tcp_put,
NULL, /* get */
NULL, /* get */
mca_btl_tcp_dump,
NULL, /* mpool */
NULL, /* register error */
Expand Down Expand Up @@ -190,11 +190,7 @@ mca_btl_base_descriptor_t* mca_btl_tcp2_alloc(
if( OPAL_UNLIKELY(NULL == frag) ) {
return NULL;
}

#define GB_DEFINED 0
#if GB_DEFINED
opal_output(0, "alloc_frag( size = %lu )\n", size);
#endif /* GB_DEFINED */

frag->segments[0].seg_len = size;
frag->segments[0].seg_addr.pval = frag+1;

Expand Down Expand Up @@ -308,10 +304,6 @@ mca_btl_base_descriptor_t* mca_btl_tcp2_prepare_src(
frag->base.des_flags = flags;
frag->base.order = MCA_BTL_NO_ORDER;
*size = max_data;
#if GB_DEFINED
opal_output(0, "prepare_src( bConverted = %lu, size = %lu\n",
convertor->bConverted, *size);
#endif /* GB_DEFINED */
return &frag->base;
}

Expand Down Expand Up @@ -359,10 +351,6 @@ mca_btl_base_descriptor_t* mca_btl_tcp2_prepare_dst(
frag->base.des_dst_cnt = 1;
frag->base.des_flags = flags;
frag->base.order = MCA_BTL_NO_ORDER;
#if GB_DEFINED
opal_output(0, " prepare_dst( bConverted = %lu, size = %lu\n",
convertor->bConverted, *size);
#endif /* GB_DEFINED */
return &frag->base;
}

Expand Down Expand Up @@ -404,9 +392,6 @@ int mca_btl_tcp2_send( struct mca_btl_base_module_t* btl,
frag->hdr.type = MCA_BTL_TCP_HDR_TYPE_SEND;
frag->hdr.count = 0;
if (endpoint->endpoint_nbo) MCA_BTL_TCP_HDR_HTON(frag->hdr);
#if GB_DEFINED
opal_output(0, "frag_send( size = %u )\n", frag->hdr.size );
#endif /* GB_DEFINED */
return mca_btl_tcp_endpoint_send(endpoint,frag);
}

Expand Down Expand Up @@ -448,9 +433,6 @@ int mca_btl_tcp2_put( mca_btl_base_module_t* btl,
frag->hdr.type = MCA_BTL_TCP_HDR_TYPE_PUT;
frag->hdr.count = frag->base.des_dst_cnt;
if (endpoint->endpoint_nbo) MCA_BTL_TCP_HDR_HTON(frag->hdr);
#if GB_DEFINED
opal_output(0, "frag_put( size = %u )\n", frag->hdr.size );
#endif /* GB_DEFINED */
return ((i = mca_btl_tcp_endpoint_send(endpoint,frag)) >= 0 ? OMPI_SUCCESS : i);
}

Expand Down Expand Up @@ -488,9 +470,6 @@ int mca_btl_tcp2_get(
frag->hdr.type = MCA_BTL_TCP_HDR_TYPE_GET;
frag->hdr.count = frag->base.des_src_cnt;
if (endpoint->endpoint_nbo) MCA_BTL_TCP_HDR_HTON(frag->hdr);
#if GB_DEFINED
opal_output(0, "frag_get( size = %u )\n", frag->hdr.size );
#endif /* GB_DEFINED */
return ((rc = mca_btl_tcp_endpoint_send(endpoint,frag)) >= 0 ? OMPI_SUCCESS : rc);
}

Expand Down Expand Up @@ -541,7 +520,7 @@ void mca_btl_tcp_dump(struct mca_btl_base_module_t* base_btl,
opal_list_item_t *item;

for(item = opal_list_get_first(&btl->tcp_endpoints);
item != opal_list_get_end(&btl->tcp_endpoints);
item != opal_list_get_end(&btl->tcp_endpoints);
item = opal_list_get_next(item)) {
mca_btl_tcp_endpoint_dump( (mca_btl_base_endpoint_t*)item, "TCP" );
}
Expand Down
77 changes: 18 additions & 59 deletions contrib/build-mca-comps-outside-of-tree/btl_tcp2_endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#include "ompi/mca/btl/base/btl_base_error.h"
#include "ompi/mca/rte/rte.h"

#include "btl_tcp_endpoint.h"
#include "btl_tcp_endpoint.h"
#include "btl_tcp_proc.h"
#include "btl_tcp_frag.h"

Expand Down Expand Up @@ -160,7 +160,7 @@ void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char
#endif

if((flags = fcntl(btl_endpoint->endpoint_sd, F_GETFL, 0)) < 0) {
BTL_ERROR(("fcntl(F_GETFL) failed: %s (%d)",
BTL_ERROR(("fcntl(F_GETFL) failed: %s (%d)",
strerror(opal_socket_errno), opal_socket_errno));
}

Expand All @@ -176,7 +176,7 @@ void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char
#if defined(SO_RCVBUF)
obtlen = sizeof(rcvbuf);
if(getsockopt(btl_endpoint->endpoint_sd, SOL_SOCKET, SO_RCVBUF, (char *)&rcvbuf, &obtlen) < 0) {
BTL_ERROR(("SO_RCVBUF option: %s (%d)",
BTL_ERROR(("SO_RCVBUF option: %s (%d)",
strerror(opal_socket_errno), opal_socket_errno));
}
#else
Expand All @@ -185,15 +185,15 @@ void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char
#if defined(TCP_NODELAY)
obtlen = sizeof(nodelay);
if(getsockopt(btl_endpoint->endpoint_sd, IPPROTO_TCP, TCP_NODELAY, (char *)&nodelay, &obtlen) < 0) {
BTL_ERROR(("TCP_NODELAY option: %s (%d)",
BTL_ERROR(("TCP_NODELAY option: %s (%d)",
strerror(opal_socket_errno), opal_socket_errno));
}
#else
nodelay = 0;
#endif
}

mca_btl_base_err("%s %s: endpoint %p src %s - dst %s nodelay %d sndbuf %d rcvbuf %d flags %08x\n",
mca_btl_base_err("%s %s: endpoint %p src %s - dst %s nodelay %d sndbuf %d rcvbuf %d flags %08x\n",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg, (void*)btl_endpoint, src, dst, nodelay, sndbuf, rcvbuf, flags);

switch(btl_endpoint->endpoint_state) {
Expand Down Expand Up @@ -222,7 +222,7 @@ void mca_btl_tcp_endpoint_dump(mca_btl_base_endpoint_t* btl_endpoint, const char
#endif /* MCA_BTL_TCP_ENDPOINT_CACHE */
(void*)btl_endpoint->endpoint_send_frag, (void*)btl_endpoint->endpoint_recv_frag );
for(item = opal_list_get_first(&btl_endpoint->endpoint_frags);
item != opal_list_get_end(&btl_endpoint->endpoint_frags);
item != opal_list_get_end(&btl_endpoint->endpoint_frags);
item = opal_list_get_next(item)) {
mca_btl_tcp_dump_frag( (mca_btl_tcp_frag_t*)item, " | send" );
}
Expand All @@ -239,9 +239,9 @@ static inline void mca_btl_tcp2_endpoint_event_init(mca_btl_base_endpoint_t* btl
btl_endpoint->endpoint_cache_pos = btl_endpoint->endpoint_cache;
#endif /* MCA_BTL_TCP_ENDPOINT_CACHE */

opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_recv_event,
btl_endpoint->endpoint_sd,
OPAL_EV_READ|OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_recv_handler,
btl_endpoint );
/**
Expand All @@ -250,9 +250,9 @@ static inline void mca_btl_tcp2_endpoint_event_init(mca_btl_base_endpoint_t* btl
* will be fired only once, and when the endpoint is marked as
* CONNECTED the event should be recreated with the correct flags.
*/
opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE,
opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE,
mca_btl_tcp_endpoint_send_handler,
btl_endpoint);
}
Expand Down Expand Up @@ -291,11 +291,6 @@ int mca_btl_tcp2_endpoint_send(mca_btl_base_endpoint_t* btl_endpoint, mca_btl_tc
} else {
btl_endpoint->endpoint_send_frag = frag;
frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
#define GB_DEFINED 0
#if GB_DEFINED
opal_output(0, "%s:%d add the send event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
MCA_BTL_TCP_ACTIVATE_EVENT(&btl_endpoint->endpoint_send_event, 0);
}
} else {
Expand Down Expand Up @@ -376,7 +371,7 @@ bool mca_btl_tcp2_endpoint_accept(mca_btl_base_endpoint_t* btl_endpoint,
OPAL_THREAD_LOCK(&btl_endpoint->endpoint_recv_lock);
OPAL_THREAD_LOCK(&btl_endpoint->endpoint_send_lock);

cmpval = ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL,
cmpval = ompi_rte_compare_name_fields(OMPI_RTE_CMP_ALL,
&endpoint_proc->proc_ompi->proc_name,
this_proc);
if((btl_endpoint->endpoint_sd < 0) ||
Expand All @@ -394,10 +389,6 @@ bool mca_btl_tcp2_endpoint_accept(mca_btl_base_endpoint_t* btl_endpoint,
/* NOT NEEDED if we remove the PERSISTENT flag when we create the
* first recv_event.
*/
#if GB_DEFINED
opal_output(0, "%s:%d add the recv event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
opal_event_add(&btl_endpoint->endpoint_recv_event, 0); /* TODO */
mca_btl_tcp_endpoint_connected(btl_endpoint);
#if OPAL_ENABLE_DEBUG && WANT_PEER_DUMP
Expand Down Expand Up @@ -452,8 +443,8 @@ static void mca_btl_tcp2_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoin
btl_endpoint->endpoint_retries = 0;

/* Create the send event in a persistent manner. */
opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
opal_event_set(mca_btl_tcp_event_base, &btl_endpoint->endpoint_send_event,
btl_endpoint->endpoint_sd,
OPAL_EV_WRITE | OPAL_EV_PERSIST,
mca_btl_tcp_endpoint_send_handler,
btl_endpoint );
Expand All @@ -463,10 +454,6 @@ static void mca_btl_tcp2_endpoint_connected(mca_btl_base_endpoint_t* btl_endpoin
btl_endpoint->endpoint_send_frag = (mca_btl_tcp_frag_t*)
opal_list_remove_first(&btl_endpoint->endpoint_frags);
}
#if GB_DEFINED
opal_output(0, "%s:%d add the send event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
}
}
Expand Down Expand Up @@ -618,10 +605,6 @@ static int mca_btl_tcp2_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endp
/* non-blocking so wait for completion */
if(opal_socket_errno == EINPROGRESS || opal_socket_errno == EWOULDBLOCK) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECTING;
#if GB_DEFINED
opal_output(0, "%s:%d add the send event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
MCA_BTL_TCP_ACTIVATE_EVENT(&btl_endpoint->endpoint_send_event, 0);
return OMPI_SUCCESS;
}
Expand All @@ -641,10 +624,6 @@ static int mca_btl_tcp2_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endp
/* send our globally unique process identifier to the endpoint */
if((rc = mca_btl_tcp2_endpoint_send_connect_ack(btl_endpoint)) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECT_ACK;
#if GB_DEFINED
opal_output(0, "%s:%d add the recv event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
MCA_BTL_TCP_ACTIVATE_EVENT(&btl_endpoint->endpoint_recv_event, 0);
} else {
mca_btl_tcp2_endpoint_close(btl_endpoint);
Expand All @@ -667,10 +646,6 @@ static void mca_btl_tcp2_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_
mca_btl_tcp2_proc_tosocks(btl_endpoint->endpoint_addr, &endpoint_addr);

/* unregister from receiving event notifications */
#if GB_DEFINED
opal_output(0, "%s:%d remove the send event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
opal_event_del(&btl_endpoint->endpoint_send_event);

/* check connect completion status */
Expand All @@ -682,10 +657,6 @@ static void mca_btl_tcp2_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_
return;
}
if(so_error == EINPROGRESS || so_error == EWOULDBLOCK) {
#if GB_DEFINED
opal_output(0, "%s:%d add the send event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
opal_event_add(&btl_endpoint->endpoint_send_event, 0);
return;
}
Expand All @@ -699,10 +670,6 @@ static void mca_btl_tcp2_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_

if(mca_btl_tcp2_endpoint_send_connect_ack(btl_endpoint) == OMPI_SUCCESS) {
btl_endpoint->endpoint_state = MCA_BTL_TCP_CONNECT_ACK;
#if GB_DEFINED
opal_output(0, "%s:%d add the recv event on socket %d\n",
__FILE__, __LINE__, btl_endpoint->endpoint_sd); /* GB */
#endif /* GB_DEFINED */
opal_event_add(&btl_endpoint->endpoint_recv_event, 0);
} else {
mca_btl_tcp2_endpoint_close(btl_endpoint);
Expand Down Expand Up @@ -752,8 +719,8 @@ static void mca_btl_tcp2_endpoint_recv_handler(int sd, short flags, void* user)
data_still_pending_on_endpoint:
if(NULL == frag) {

if(mca_btl_tcp_module.super.btl_max_send_size >
mca_btl_tcp_module.super.btl_eager_limit) {
if(mca_btl_tcp_module.super.btl_max_send_size >
mca_btl_tcp_module.super.btl_eager_limit) {
MCA_BTL_TCP_FRAG_ALLOC_MAX(frag);
} else {
MCA_BTL_TCP_FRAG_ALLOC_EAGER(frag);
Expand All @@ -771,7 +738,7 @@ static void mca_btl_tcp2_endpoint_recv_handler(int sd, short flags, void* user)
btl_endpoint->endpoint_recv_frag = frag;
} else {
btl_endpoint->endpoint_recv_frag = NULL;

TODO_MCA_BTL_TCP_RECV_TRIGGER_CB(frag);

#if MCA_BTL_TCP_ENDPOINT_CACHE
Expand Down Expand Up @@ -853,19 +820,11 @@ static void mca_btl_tcp2_endpoint_send_handler(int sd, short flags, void* user)

/* if no more data to send unregister the send notifications */
if(NULL == btl_endpoint->endpoint_send_frag) {
#if GB_DEFINED
opal_output(0, "%s:%d remove the send event on socket %d\n",
__FILE__, __LINE__, sd); /* GB */
#endif /* GB_DEFINED */
opal_event_del(&btl_endpoint->endpoint_send_event);
}
break;
default:
BTL_ERROR(("invalid connection state (%d)", btl_endpoint->endpoint_state));
#if GB_DEFINED
opal_output(0, "%s:%d remove the send event on socket %d\n",
__FILE__, __LINE__, sd); /* GB */
#endif /* GB_DEFINED */
opal_event_del(&btl_endpoint->endpoint_send_event);
break;
}
Expand Down
6 changes: 3 additions & 3 deletions contrib/build-mca-comps-outside-of-tree/btl_tcp2_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void mca_btl_tcp2_proc_destruct(mca_btl_tcp2_proc_t* tcp_proc)
{
/* remove from list of all proc instances */
MCA_BTL_TCP_CRITICAL_SECTION_ENTER(&mca_btl_tcp_component.tcp_lock);
opal_hash_table_remove_value_uint64(&mca_btl_tcp_component.tcp_procs,
opal_hash_table_remove_value_uint64(&mca_btl_tcp_component.tcp_procs,
ompi_rte_hash_name(&tcp_proc->proc_ompi->proc_name));
MCA_BTL_TCP_CRITICAL_SECTION_LEAVE(&mca_btl_tcp_component.tcp_lock);

Expand All @@ -105,7 +105,7 @@ mca_btl_tcp2_proc_t* mca_btl_tcp2_proc_create(ompi_proc_t* ompi_proc)
mca_btl_tcp2_proc_t* btl_proc;

MCA_BTL_TCP_CRITICAL_SECTION_ENTER(&mca_btl_tcp_component.tcp_lock);
rc = opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
rc = opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
hash, (void**)&btl_proc);
if(OMPI_SUCCESS == rc) {
MCA_BTL_TCP_CRITICAL_SECTION_LEAVE(&mca_btl_tcp_component.tcp_lock);
Expand Down Expand Up @@ -713,7 +713,7 @@ mca_btl_tcp2_proc_t* mca_btl_tcp2_proc_lookup(const orte_process_name_t *name)
{
mca_btl_tcp_proc_t* proc = NULL;
MCA_BTL_TCP_CRITICAL_SECTION_ENTER(&mca_btl_tcp_component.tcp_lock);
opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
opal_hash_table_get_value_uint64(&mca_btl_tcp_component.tcp_procs,
ompi_rte_hash_name(name), (void**)&proc);
MCA_BTL_TCP_CRITICAL_SECTION_LEAVE(&mca_btl_tcp_component.tcp_lock);
return proc;
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/pml/ob1/pml_ob1.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* Copyright (c) 2004-2016 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -267,7 +267,7 @@ do { \
opal_mutex_lock(lock); \
} \
else { OPAL_THREAD_LOCK(lock); } \
} while(0)
} while(0)


#define OB1_MATCHING_UNLOCK(lock) \
Expand All @@ -276,10 +276,10 @@ do { \
opal_mutex_unlock(lock); \
} \
else { OPAL_THREAD_UNLOCK(lock); } \
} while(0)
} while(0)




int mca_pml_ob1_send_fin(ompi_proc_t* proc, mca_bml_base_btl_t* bml_btl,
opal_ptr_t hdr_frag, uint64_t size, uint8_t order, int status);

Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/pml/ob1/pml_ob1_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 The University of Tennessee and The University
* Copyright (c) 2004-2016 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -286,7 +286,7 @@ mca_pml_ob1_component_init( int* priority,
mca_pml_ob1.super.pml_flags |= MCA_PML_BASE_FLAG_REQUIRE_WORLD;
break;
}

}

/* Set this here (vs in component_open()) because
Expand Down
Loading

0 comments on commit f69eba1

Please sign in to comment.